<div dir="ltr">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.<br><br>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.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 17, 2015 at 2:55 PM, Imants Cekusins <span dir="ltr"><<a href="mailto:imantc@gmail.com" target="_blank">imantc@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Does anyone see any benefit from process scope variables?<br>
<br>
E.g.<br>
a()-><br>
</span> A = 10,<br>
b().<br>
<br>
b()-><br>
B = A + 1.<br>
<br>
If unset variable is referenced, an error is raised.<br>
<br>
If set process variable is assigned to (and does not pattern match),<br>
an error is raised.<br>
<br>
<br>
This way, there is no need to pass a bunch of static variables around.<br>
<br>
?<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>