[erlang-questions] Erlang Syntax - again

Michael FIG fig@REDACTED
Tue Mar 11 02:19:52 CET 2008


Hi again,

[Sorry for the self-reply, but on reading more e-mail it seems a lot of people are focusing on this issue.  This is a continuation of my prior mail.]

My suggestion for top-level functions would be:

doit(abc) ->
  some(),
  other(),
  stuff(),
;
doit(def) ->
  some(),
  stuff(),
;

fruit(apple) ->
  ok,
;


In other words, allow semicolon to be used as a substitute for period (by eliminating the "head mismatch" error when it is followed by another function, and the "unterminated function" error when it is at the end of file), and allow an optional comma before the function terminator.

Then, people can program as if "," means "end expression" and ";" means "end block".  Note that all of these suggestions are backward-compatible with the old syntax.  I think that would help satisfy the separator vs. terminator debate without having to force anybody to change their existing style (or (heaven forbid!) introduce whitespace into the syntax ala Python or Haskell).

I hope this answers your question as to my own personal annoyance, and how I would solve it if I had a choice,

-- 
Michael FIG <fig@REDACTED>, PMP
MarkeTel Multi-Line Dialing Systems, Ltd.
Phone: (306) 359-6893 ext. 528




More information about the erlang-questions mailing list