Rule 176p-dyn-main
Comments
The value of main is taken from , the value environment of all the top-level declarations of the module (rule (113)), not from the basis , which holds only what the module exposes; so main need not be exposed. No module imports the main module, and 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
- The comment on rule
p-stat-main-program(Chapter 9) - Section 9.3 Evaluation of Programs
TeX source
\defnrule[r:p-dyn-main]
{\jdg{\pgBdyn}{\modm}{\pgBdyn',\VE}\premsep v=\VE(\kw{main})}
{\jdyn{\pgBdyn}{\modm}{v}}Tests (2)
- elm / EntryMainOfRootModuleTestA program's entry point is the `main` of the module being compiled, even when an imported module also defines and exposes a `main`.
- elm / HelloTestThe 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.