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

Eric Merritt cyberlync@REDACTED
Thu Mar 8 09:55:06 CET 2007


Having a fully functional repl would be very nice. I have wanted to
see this happen for a very long time. Just tonight it would have been
a nice feature to have. You can get by without it but it would be very
convenient.

On 3/8/07, Joe Armstrong <erlang@REDACTED> wrote:
>  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
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list