From c0ddfdf7e8af4aaac409f2e68218404f7a46ae02 Mon Sep 17 00:00:00 2001 From: James Clark Date: Thu, 9 May 2024 13:02:19 +0700 Subject: [PATCH] Add alternative-receive-action Part of #1277 --- lang/spec.html | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/lang/spec.html b/lang/spec.html index 6a9b5816..f14b4efb 100644 --- a/lang/spec.html +++ b/lang/spec.html @@ -8397,7 +8397,7 @@
Sync send action

Receiving messages

receive-action := single-receive-action | multiple-receive-action
+class="grammar">receive-action := single-receive-action | multiple-receive-action | alternate-receive-action
 

Each receive-action has one or more references to peer workers. A reference to a @@ -8509,6 +8509,47 @@

Multiple receive action
the multiple-receive-action
  • F is the union of the send failure types of the slots
  • + +
    +
    Alternate receive action
    + +
    alternate-receive-action := <- peer-worker (| peer-worker)+
    +
    + +

    +An alternate-receive-action receives a message from one of multiple peer-workers. +

    +

    +As with other receive actions, each reference to a peer worker is associated with a slot in +a queue. An alternate-receive-action is evaluated by repeatedly waiting until either +

    + +

    +The static type of the alternative-receive-action is T|F, where T is union of +message type of the associated slots and F is the union the send failure type of +the slots. +

    +
    @@ -11740,6 +11781,7 @@

    Summary of changes from 2023R1 to 2024R1

  • The compile-time requirement that a send-action must always be executed unless its containing worker terminates with an error or panic has been removed.
  • +
  • An alternate-receive-action has been added.