Elm Exactly

Rule 176p-dyn-main

Evaluation of ProgramsBDYN⊢DYNprogram⇒v\jdyn{\pgBdyn}{\program}{v}
BDYN⊢module⇒BDYN′,VEv=VE(main)BDYN⊢DYNmodule⇒v\frac{\begin{array}{c}\jdg{\pgBdyn}{\modm}{\pgBdyn',\VE}\premsep v=\VE(\kw{main})\end{array}}{\begin{array}{c}\jdyn{\pgBdyn}{\modm}{v}\end{array}}
(176)
Read it in its chapter·Permanent address: /standard/rules/p-dyn-main

Comments

The value of main is taken from VE\VE, the value environment of all the top-level declarations of the module (rule (113)), not from the basis BDYN′\pgBdyn', which holds only what the module exposes; so main need not be exposed. No module imports the main module, and BDYN′\pgBdyn' is not used. If a top-level value of any module has no value (it reaches Debug.todo, or forces a delayed reference to itself), no sentence about the program can be inferred, and the program has no meaning.

Referred to from

TeX source
\defnrule[r:p-dyn-main]
  {\jdg{\pgBdyn}{\modm}{\pgBdyn',\VE}\premsep v=\VE(\kw{main})}
  {\jdyn{\pgBdyn}{\modm}{v}}

Tests (2)

  • elm / EntryMainOfRootModuleTest
    A program's entry point is the `main` of the module being compiled, even when an imported module also defines and exposes a `main`.
  • elm / HelloTest
    The smallest program: a `main` that logs the string `"hello"` with `Debug.log` and renders it as text.

Discussions

Discuss this rule·Search the discussions on GitHub

Discussions are on GitHub; one about this rule has [r:p-dyn-main] in its title.

A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.