Rule 182p-init
Comments
The host starts a program with a boundary value as its flags; when the host gives no flags, is . With flags of the unit type every boundary value is accepted, whereas a port of the unit type accepts only . When is undefined, as for with flags type Int, no rule applies, there is no configuration in which the program begins, and the program does not start; how an implementation reports this is outside the definition (Appendix E). The commands of init are dispatched, and the subscriptions computed from the initial model, before any message is handled. The empty map serves here as the empty process map and the empty multiset.
TeX source
\defnrule[r:p-init]
{\pgFlags{\tau_1}(j)=v_1\premsep\japp{r(\kw{init})}{v_1}{(v,\cm)}\\
\effFlat(\cm)=\effmset{\effc_1,\ldots,\effc_n}\premsep
\jdg{0,\ \emptymap,\ \pgQinit,\ \emptymap}{\effc_1\cdots\effc_n}{(P,Q,H)}\\
\japp{r(\kw{subscriptions})}{v}{\sbv}}
{\jdg{\PE,\tau_1,j}{\effprog\,r}{(0,v,\pgnil,P,\sbv,Q,H)}}Tests (3)
- elm / FlagsRecordTestA `Platform.worker` whose flags are a record of an `Int`, a `String` and a `Bool` receives the decoded record in `init`.
- elm / OutgoingPortTuple3TestTests that a program with an outgoing port whose payload is a 3-tuple `( String, String, List String )` compiles and runs.
- elm / StandardA72AbsentFlagsTestA program given no flags starts with flags `null`: `Maybe` flags are `Nothing`.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:p-init] 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.