Elm Exactly

Rule 190p-in-accept

TransitionsK→⟨ℓ⟩K′K\step{\opt{\ell}}K'
PE(p)=(in,τ)Decτ(j)=v′Flat(sb)={ ⁣∣ c1,…,cn ∣ ⁣}for 1≤i≤n:  ⊢ci◃(p,j)⇒Mi,or Mi=nil and ⊢ci◃(p,j)⇒v′′ for no v′′(s,v,M,P,sb,Q,H)→in(p,j)(s,v,M⋅M1⋯Mn,P,sb,Q,H)\frac{\begin{array}{c}\PE(\effp)=(\smdirin,\tau)\premsep\Dec{\tau}(j)=v'\premsep \effFlat(\sbv)=\effmset{\effc_1,\ldots,\effc_n}\\ \text{for}\ 1\leq i\leq n:\ \ \effrecv{\effc_i}{(\effp,j)}{M_i},\\ \text{or}\ M_i=\pgnil\ \text{and}\ \effrecv{\effc_i}{(\effp,j)}{v''}\ \text{for no}\ v''\end{array}}{\begin{array}{c}(s,v,M,P,\sbv,Q,H)\step{\pgEvIn(\effp,j)} (s,v,M\cdot M_1\cdots M_n,P,\sbv,Q,H)\end{array}}
(190)
Read it in its chapter·Permanent address: /standard/rules/p-in-accept

Comments

An incoming value is an event of its own, so it is never handled in the middle of another step; its messages join the end of the queue, and are handled by later updates. Each leaf subscription on p\effp gives one message, through the functions of the map\effmaps around it; a leaf on another port, or of another manager, gives none, and so does a leaf whose functions give no result. The order of the messages of one value follows the enumeration of Flat(sb)\effFlat(\sbv), and is unspecified. A value accepted while no subscription is current gives no message.

Referred to from

TeX source
\defnrule[r:p-in-accept]
  {\PE(\effp)=(\smdirin,\tau)\premsep\Dec{\tau}(j)=v'\premsep
   \effFlat(\sbv)=\effmset{\effc_1,\ldots,\effc_n}\\
   \text{for}\ 1\leq i\leq n:\ \ \effrecv{\effc_i}{(\effp,j)}{M_i},\\
   \text{or}\ M_i=\pgnil\ \text{and}\
   \effrecv{\effc_i}{(\effp,j)}{v''}\ \text{for no}\ v''}
  {(s,v,M,P,\sbv,Q,H)\step{\pgEvIn(\effp,j)}
   (s,v,M\cdot M_1\cdots M_n,P,\sbv,Q,H)}

Tests (10)

  • elm / CoreIssue1141UnusedPortCallBreaksSubscriptionTest
    An unused port call (`_ = echoOut "unused"` in `init`) breaks a port subscription elsewhere.
  • elm / PortEchoTest
    An `Int` sent out through an outgoing port comes back unchanged through an incoming port.
  • elm / PortIncomingRejectTest
    A value that does not decode at an incoming port's type is rejected, and the program goes on.
  • elm / PortPipeBytesRejectTest
    A JSON value sent to a `Bytes` port is rejected, whatever it holds.
  • elm / PortPipeBytesTest
    A byte sequence received at `Bytes` goes out again as the same byte sequence.
  • elm / PortPipeRejectTest
    Values that do not decode at an incoming port's type are rejected, and the program goes on.
  • elm / PortPipeValueRejectsBytesTest
    A byte sequence sent to a `Json.Encode.Value` port is rejected, alone or inside an object.
  • elm / PortPipeValueTest
    A JSON value received at `Json.Encode.Value` goes out again as the same JSON value.
  • elm-core / CoreIssue1110PortDeclarationOrderTest
    A subscription returned together with a port command is active in time to receive that command's synchronous reply.
  • elm-core / CoreIssue1154PortSubscribedWithCmdTest
    A port subscription added by the same `update` that sends a command to an outgoing port misses the outgoing port's synchronous reply, depending on the order of the ports in the generated code.

Discussions

Discuss this rule·Search the discussions on GitHub

Discussions are on GitHub; one about this rule has [r:p-in-accept] 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.