[erlang-questions] Uniqueness Typing for Resource Management in Message-Passing Concurrency
Thu Jul 3 16:01:24 CEST 2014
I agree on your overall point that channel-based formalisms do not map
well to Erlang. A few more points:
On Thu, Jul 3, 2014 at 2:47 PM, Fred Hebert <mononcqc@REDACTED> wrote:
> This sounds like it would be nicer for a language with actual channels.
> There are a few differences with Pi-Calculus and Erlang:
> - Pi-Calculus assumes synchronous message delivery, Erlang doesn't
Just like there are many variants lambda-calculi, there are many
variants of pi-calculi. Some of them synchronous, some of them not.
> - Pi-Calculus assumes the usage of channels that are nameable and
> passable as if they were variables, Erlang has a per-process mailbox
> (you can pass pids as if they were channels and treat specific
> processes as channels, I guess)
You could indeed split up each process into multiple sub-processes
where each of them corresponds to a particular pi-calculus channel.
Then you can "kind of" do channel delegation by sending pids. However
the caveat is that in Erlang, receiving a pid only means that you can
send things to it. This is like knowing someone's email address. In
pi-calculus receiving a channel's name means that you can send and
*receive* on that channel. This is more like getting a pointer to a
queue in shared memory, to which you can now both pop and push.
This latter is IMHO a crucial difference and makes the usual
pi-calculi unsuitable (or at least unworkable) for modeling Erlang
semantics. I think a much better formalism for actor-like systems is
the join-calculus. There is even a project which extends Erlang with
join-patterns called JErlang, very cool stuff:
More information about the erlang-questions