[erlang-questions] return list or send message back
Chris Hicks
silent_vendetta@REDACTED
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
> From: comptekki@REDACTED
> To: erlang-questions@REDACTED
> 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.
>
> thanks,
>
> -wes
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111017/0ac7b692/attachment.htm>
More information about the erlang-questions
mailing list