[erlang-questions] Why does this compile without warnings/errors?

Ivan Uemlianin ivan@REDACTED
Tue Jul 9 21:11:42 CEST 2013


This is called a "selective receive".

--
festina lente


On 9 Jul 2013, at 20:02, "Yves S. Garret" <yoursurrogategod@REDACTED> wrote:

> I'm looking at this code:
> 
> loop(ExoSelf_PId) ->
>   receive
>     {ExoSelf_PId, {Id, Cx_PId, ActuatorName, Fanin_PIds}} ->
>       loop(Id, Cx_PId, ActuatorName, {Fanin_PIds, Fanin_PIds}, [])
>   end.
> 
> Now, what I'm not quite 'getting' is why the compiler is not complaining about 
> ExoSelf_PId.  First of all, it's not used anywhere.  Second of all, if it's used, it's 
> used to bind (to an already bound) variable and that's the message that's received 
> to this process.  If I were to pass in Foo and then do Foo = 5, the compiler would 
> tell me that that is impossible, so what is different in this case?
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list