Relation to Pi Calculus
Tue Oct 14 14:00:07 CEST 2003
On Mon, 13 Oct 2003, David Van Horn wrote:
> I've heard that Erlang is essentially an implementation of the untyped
> pi calculus. Is this a fair characterization?
To say that it is "essentially an implementation of untyped pi calculus"
is not very accurate. Erlang is a lot larger than just
send/receive/inparallel. Also, in pi calculus *everything* is done by
separate processes, while in Erlang, a single process does its internal
work by means of executing a functional program. Furthermore, in Erlang
you cannot create separate channels - there is only one channel per
process (multiple writers allowed, but only the owner process can read
from it) which is identified with the process Id. Separate channels must
be simulated by tagging the messages.
> Which variant of the pi calculus most closely resembles Erlang (eg,
> asynchronous pi, distributed pi, seal, join, etc.)? Could someone
> provide examples of Erlang primitives that closely rememble the pi
> calculus primitives: input, output, and restriction?
Process communication in Erlang is asynchronous. The primitives are
'ReceiverPid ! Message', 'receive M -> ... end' and 'spawn(...)'.
'!' is the asynchronous send operator. The function 'spawn(...)' takes a
description of the code to be executed, and creates a new process for
performing that code in parallel, while returning the new process Id to
the parent process.
The receive statement can have several clauses, with pattern matching on
the format of the message, and can leave messages in the incoming queue
if they do not match any of the current patterns. There can also be a
time-out clause which triggers after a certain number of milliseconds.
For more details, see "Concurrent Programming in Erlang", in PDF here:
> Does a formal semantics of core Erlang exist, and if so where?
No formal semantics yet - the only definition is in natural language:
Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED WWW: http://user.it.uu.se/~richardc/
"Having users is like optimization: the wise course is to delay it."
-- Paul Graham
More information about the erlang-questions