[erlang-questions] Changing the shell and module syntax and semantics
Joe Armstrong
erlang@REDACTED
Thu Mar 8 09:30:18 CET 2007
Something to think about ...
In the book beta, many people are reporting errors when they type things
like
-record(a, {b,v,d}).
fac(0) -> 1;
fac(N) -> N*fac(N-1)
into the shell.
They don't understand that some things are for the shell, others for modules.
I Talked to Dave Thomas (Prag P) - he said "why can't you type
everything into the shell"
I said bla bla bla .., any explained how it is
He said - but it must be easy to implement ....
Having slept on it I think he's right.
Why not?
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.
.... etc....
This would *greatly* increase the power of Erlang and make things
nicely symmetric
we can pipe modules into the shell and vice versa, no change. We can
have a shell
session and save it as a module ...
/Joe
More information about the erlang-questions
mailing list