[erlang-questions] return list or send message back
Mon Oct 17 23:15:12 CEST 2011
Returning something from a function and passing a message are two completely different mechanisms. You can only 'return' a result from a function that has been 'called' such as:
initial_function() do stuff .... .... Value = call_function() do more stuff ....
call_function() -> do stuff .... .... return value.
If you send a message from Process A to Process B, the only way to get anything from B to A would be to send a message back using the PID. Be careful in doing this that you don't create a situation where both processes are waiting for a message from the other in order to continue.
> Date: Mon, 17 Oct 2011 15:09:23 -0600
> Subject: [erlang-questions] return list or send message back
> I'm trying to learn how message passing works so I have a function
> that sends an "ls" message to another node and then when the other
> node receives it since "ls" is one of the matches for that it then
> runs a routine to list the files in a folder. Should I build a list
> and return the results or send a message back with the results.
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions