[erlang-questions] Why do we need modules at all?
Wed May 25 10:55:21 CEST 2011
On Wed, May 25, 2011 at 07:58, Vance Shipley <> wrote:
> I love the idea of ditching modules files and storing functions
> in a data store. What I'm picturing though is that the functions
> are stored in their abstract syntax form (i.e. data) so that the
> issue of formatting standards is stripped away.
> The problem with that plan seems to be with the preprocessor. It
> seems to me though that your plan suffers the same problem. If
> macros are defined at a module level, or in an include file, you'll
> have to deal with them when you pull the functions out of the module
> and stuff it into the data store. The extended syntax tree used in
> the erl_syntax application might be the answer.
There are more things that need to be preserved by the parser, which make
existing pretty-printers less than good. For example:
- integer values can be shown using different bases, from case to case, so
one can't use a generic setting. So the parser needs to keep track of that.
- comments have to be anchored somewhere in the code. erl_syntax guesses
only almost right. Of course, if there is going to be a more advanced
metadata mechanism, the comments belong there too.
Also, I didn't understand where/how are record and macro definitions going
to be stored and identified. As somebody else said it too, the best solution
would be to get rid of them altogether and it's starting to look more and
more like a different language :-)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions