[erlang-questions] Avoiding case nesting
Tue Sep 29 20:48:46 CEST 2009
Robert Virding wrote:
> 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
>> 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
An example of this is here:
More information about the erlang-questions