Skip to content

POPL 2013 examples #23

@bennn

Description

@bennn

The first (?) paper on choreographies has some interesting examples.
https://dl.acm.org/doi/10.1145/2480359.2429101

  • Example 3 in section 2 has a Seller, two Buyers, and two Helpers (one for each buyer). The Buyer-Helper conversations are supposed to go out of order. Also, Buyer2's helper is supposed to send a result to the Seller to end the top-level choreography.
  • Section 7 has one example of Audio Video Processing (AVP) and one with Open ID. Both seem decently realistic.

I started Example 3 in Chorex but got stuck deciding how to end the toplevel choreograpy:

defmodule C0 do
  import Chorex

  defchor [Buyer1, Buyer2, Seller] do
    def run(Buyer1.(book)) do
      Buyer1.(book) ~> Seller.(the_book)
      Seller.get_price(the_book) ~> Buyer1.(y1)
      Seller.get_price(the_book) ~> Buyer2.(z1)
      Buyer1.contrib(y1) ~> Buyer2.(z2)

      # ... start a sub-choreography. Don't care about the result.
      Buyer1.start_handler(0.5 * contrib(y1)) # result unused? paper is confusing

      # ... start a sub-chor ... and somehow this one has to communicate a result to Seller
      Buyer2.start_handler(0.5 * (z1 - z2), Seller)

      # TODO test that Buyer1 handler and Buyer2 handler can run out-of-order

    end
  end

end

Hope to pick this up again soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions