[erlang-questions] remote spawns and sending messages to the remote PID

Jeff Macdonald <>
Tue Apr 14 03:34:57 CEST 2009


On Mon, Apr 13, 2009 at 12:16 AM, Lennart Öhman <> wrote:
> Hi, the reason why this does not work is that you are not doing it the same way locally versus when doing it remote. The return value bound to the shell variable S in your example is not the process identifier of your counter process, merely some kind of intermediate process you choose to use in the remote example.

ah. So there isn't a way that a PID actually represents a remote
process?  But that isn't true because if I do this:

()10> { counter, '' } ! {inc, R}.
{inc,<0.38.0>}
Value is 1

which caused this code fragment to run on the remote node:

        	{inc, Requester} when Sum < Limit	->
		    	Requester ! {ok, Sum + 1},
		    	counter(Limit, Sum + 1);

isn't the Requester variable a remote PID? What value is there to
having spawn/4 return a PID?

I'm obviously confused. :)


-- 
Jeff Macdonald
Ayer, MA



More information about the erlang-questions mailing list