[erlang-questions] Process scope variable
Dmytro Lytovchenko
dmytro.lytovchenko@REDACTED
Tue Feb 17 14:58:31 CET 2015
You're asking for trouble here -- global variables will complicate your
code and bring in hard to track errors. On the other hand, carrying few
variables in parameters or carrying a state record will make changes
performed by your code very much visible and easy to track using only your
eyes.
But anyway, if you very much want that -- process global variables can be
set by erlang:put() and can be read by erlang:get(). Enjoy your heisenbugs.
On Tue, Feb 17, 2015 at 2:55 PM, Imants Cekusins <imantc@REDACTED> wrote:
> Does anyone see any benefit from process scope variables?
>
> E.g.
> a()->
> A = 10,
> b().
>
> b()->
> B = A + 1.
>
> If unset variable is referenced, an error is raised.
>
> If set process variable is assigned to (and does not pattern match),
> an error is raised.
>
>
> This way, there is no need to pass a bunch of static variables around.
>
> ?
> _______________________________________________
> 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/20150217/10491b00/attachment.htm>
More information about the erlang-questions
mailing list