Garbage collection of atoms

Joe Armstrong joe@REDACTED
Tue Nov 2 09:51:26 CET 1999

> On Tue, 2 Nov 1999, Joe Armstrong wrote:
> > meta programming
> > 
> >       apply("mod", "func", ..)
> >       
> >       doesn't work
> If mod and func are not previously defined you have a programming
> error. 

  Well sort of, if you do apply(foo,bar, ...) and the module foo isn't loaded
then this traps into the error handler which calls the code loader which ...
which ... and the code then gets loaded.  

> I.e. when you do list_to_atom("mod"), you are almost
> certainly not creating a new atom. So when do you want to
> dynamically create atoms except when loading code?

  Convenience, speed etc.
  The problem is that while this is ok for a small program (one man hacks)
where the programmer at least should be aware of how many atoms they create
it doesn't scale. So I guess for big projects creating new ataoms should be
a "no no" - or at least subject to review.

> /Mike

More information about the erlang-questions mailing list