[erlang-questions] Changing the shell and module syntax and semantics

Vlad Dumitrescu vladdu55@REDACTED
Thu Mar 8 09:59:54 CET 2007


Hi,

On 3/8/07, Joe Armstrong <erlang@REDACTED> wrote:
>  Something to think about ...
> all we need to do is add an invisible "-module(shell)" to
> the session, remember all the stuff that's typed in and
> as new functions come either compile the complete module (so far)
> or interpret the code.
>
> Variable bindings could occur as in parameterized modules.
>
> In fact these is no good reason not to allow this in modules as well ...
>
> -module(mmm).
>
> X = 12 + lists:sqrt(23).
>
> foo(A) ->
>      A + X.

Looks like an interesting idea!

There are some things that bother me, which would need to be
considered carefully.

Where is preprocessing done when in shell mode?
Since macros need not be full correct Erlang constructs, it's going to
be tricky to ensure correctness -- on the other hand, it may be a good
opportunity to check if it's possible to restrict macros to be nicely
behaved (i.e. is anyone doing nasty things with them?) especially
since all source code handling applications assume this is the case
anyway.

Would declarations become expressions evaluated at compile-time? What
would the value be? Function definitions could "return" a fun, but
what about attributes?
By compiling a module, some arbitrary computation could be started -
is it what we'd want?

best regards,
Vlad



More information about the erlang-questions mailing list