[erlang-questions] Local namespaces in case/try

José Valim <>
Sun Jul 15 12:30:01 CEST 2012


>
> - Even if funs/comprehensions behave differently from the rest their
> behaviour is quite logical within the erlang context. For a fun to *export*
> a variable would be completely crazy as it is defined in one place and
> executed in another; where and when would you see the exported value?


Agreed. Languages like python and ruby change the context of where the
function/lambda is defined, which introduces race conditions when the
function is run in a thread. This is actually one of the ways such
languages use to communicate between threads, *shrugs*.


> For a comprehension which value of a variable should you see?
>

Agreed as well, I wouldn't expect comprehensions to set a variable in the
outer context. To add to your puzzle, if the list is empty, what is the
value of the variable?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120715/961636c3/attachment.html>


More information about the erlang-questions mailing list