# compile-time

[JS](..) ⟩ [concepts](../concept) ⟩ compile-time

{% hint style="success" %}
the <mark style="color:orange;">**period**</mark> when the <mark style="color:yellow;">**source code**</mark> (such as [C#](https://docs.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/),  [Java, C, Python](https://www.baeldung.com/cs/max-int-java-c-python)) is converted to the [machine code](https://www.baeldung.com/cs/how-compilers-work) (i.e. <mark style="color:yellow;">**binary code**</mark>).
{% endhint %}

{% tabs %}
{% tab title="⭐️ 重點" %}
{% hint style="success" %}
[scope](../scope "mention")s are determined at <mark style="color:purple;">**compile-time**</mark>.&#x20;

* [id](../grammar/token/id "mention")s are <mark style="color:yellow;">**registered**</mark> to respective [scope](../scope "mention") during <mark style="color:purple;">**compile-time**</mark>.
* <mark style="color:red;">**but in**</mark> [sloppy-mode](../concept/env/js-engine/mode/sloppy-mode "mention"), you can <mark style="color:red;">**cheat**</mark> it at [runtime](runtime "mention"). \
  ( 👉 [modify-current-scope-at-runtime](../concept/env/js-engine/mode/sloppy-mode/modify-current-scope-at-runtime "mention"):exclamation:)
{% endhint %}

{% hint style="info" %}
[vs-arg](../val/func/vs-arg "mention")

* [param](../val/func/param "mention")(s) live in <mark style="color:yellow;">**function's definition**</mark> ([compile-time](compile-time "mention"))
* [argument](../val/func/argument "mention")(s) live in <mark style="color:yellow;">**call sites**</mark> ([runtime](runtime "mention"), may be <mark style="color:red;">**different**</mark> <mark style="color:yellow;">**on each call**</mark>)
{% endhint %}
{% endtab %}

{% tab title="🔴 主題" %}
* [static](../val/type/term/static "mention") - the [type](../val/type "mention") of a [val](../val "mention") <mark style="color:red;">**can't be changed**</mark> at [runtime](runtime "mention").
* [static-binding](../grammar/token/id/static-binding "mention")\
  (the [val](../val "mention") of an [id](../grammar/token/id "mention") is <mark style="color:green;">**predetermined**</mark> at [compile-time](compile-time "mention"))
* [compile](../err/compile "mention")
{% endtab %}

{% tab title="👥 相關" %}
* [](<> "mention") - how JS is compiled
* compare：[runtime](runtime "mention")
* [scope](../scope "mention")s are <mark style="color:yellow;">**determined**</mark> at <mark style="color:purple;">**compile time**</mark>.
{% endtab %}

{% tab title="📗 參考" %}
* [ ] Baeldung ⟩ [Runtime vs. Compile Time](https://www.baeldung.com/cs/runtime-vs-compile-time)
{% endtab %}
{% endtabs %}
