Impressions of Mozart-Oz
Mon Dec 16 09:38:20 CET 2002
Roger Price writes:
> On Fri, 13 Dec 2002, Vance Shipley wrote:
> > Q: Where are the global variables?
> > A: There are none.... Don't use the process dictionary.
> What's wrong with the process dictionary? Is it a matter of performance,
> or programming style, or something else?
If the answer was:
For beginners: Be patient. Complete the course and spend
a few days writing programs without global variables
until you're completely comfortable doing that. You don't
need global variables, honest.
For others: There are various ways to to achieve similar
effects to having global variables:
1. For storing constants, you can use a function, e.g.
max_line_length() -> 80.
you may wish to enable inlining if you do the above.
2. Using a registered process to store state.
3. Using ETS tables.
4. Using the process dictionary. This is widely considered
to be bad style.
Would you expect the average beginner to think "oh, ok, that sounds like
sensible advice", or would would it be "patronising academic wankers
with functional weirdo crap, the process dictionary is just what I need"?
More information about the erlang-questions