[erlang-questions] Avoiding case nesting

Robert Virding rvirding@REDACTED
Tue Sep 29 20:22:21 CEST 2009


2009/9/29 David Mercer <dmercer@REDACTED>

> Richard O'Keefe wrote:
>
> > This suggests one way to proceed: just write this text
> > out to a file (with a suitable module header), compile
> > it, load it, and use it.  Thanks to hot loading, you can
> > repeat the process whenever you want to change the sequence
> > of strings.
>
> Correct me if I am wrong, but can you not create "virtual" modules without
> actually writing the module file.  I believe you can pass some Erlang terms
> to the compiler and have the new module compiled and loaded without the
> disk
> overhead.  Never done this, but I thought it was possible...
>

Oh yes, it is definitely possible. You create the same datastructures as you
would get reading in the file and then pass them to the compiler. Whether
you do it this way or create a file really depends on what you want/need.

Macros don't work if you create the terms and pass them directly to the
compiler.

Robert


More information about the erlang-questions mailing list