[erlang-questions] Message order and exit(Reason)

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Mon Jan 28 11:07:46 CET 2013



On Jan 28, 2013, at 10:58 AM, Richard Carlsson <carlsson.richard@REDACTED> wrote:

> The only place I seem to find this actually described is in the old (never finished) Standard Erlang Specification Draft by Barklund and Virding. In brief, Thomas is right: with regards to propagation and order, exit messages are handled like regular messages. In fact, both are instances of what the spec calls Signals, and the ordering guarantees are valid for all Signals, not just messages. The spec lists the following signals

Right. If you do not have this guarantee, there will be trouble in implementing almost anything. The key is that you can rely on the message order and this vastly simplifies the code base. Since message order is deterministic, you can avoid coding the case where messages arrive out of order sometimes. This in turn makes for simpler code. I would even predict that some things are outright *impossible* to implement if you do not have message ordering guarantees.

I know Rickard Green has made the semantics for Ports more clear in R16 because ports will be asynchronous and thus you need to know what guarantees you have about them in your program. This question, about messaging, is the same. In a language like Java or Go, you have a "memory model" which describes the semantics of passing messages and a "happens before" relation. It definitely makes sense to have the same for Erlang, so programmers know what relation they can rely on and what they can't.

Jesper Louis Andersen
  Erlang Solutions Ltd., Copenhagen




More information about the erlang-questions mailing list