[erlang-questions] erlang sucks
Richard A. O'Keefe
ok@REDACTED
Tue Mar 11 02:14:14 CET 2008
My take on the separators issue:
(1) I'm used to the Prolog approach, where every clause ends with a
full stop.
I'm also used to SML and Haskell and Clean, where again every
clause ends
the same way (with nothing). If Prolog and Haskell can figure
out that
adjacent clauses defining the same thing belong to the same
definition, it
isn't clear to me why Erlang can't. I once wrote a functional
preprocessor
for Prolog where I could write
append([], Ys) = Ys.
append([X|Xs], Ys) = [X | append(Xs, Ys)].
and the use of a dot at the end of every function clause was no
trouble at
all. Nor is it any trouble in Mercury.
I generally don't accept arguments about re-ordering definition
clauses,
because if you know what you are doing it is pretty rare. But I
*do*
accept arguments about *adding* clauses when you revise a data
type, so
I wish that Erlang would allow all function clauses to end with a
full
stop.
(2) Again, I generally don't accept arguments about re-ordering function
calls in a body. I don't find that to be a common mistake. Oh,
I do
make mistakes in Erlang. I make mistakes all the time in all
sorts of
languages. One mistake I do make in Erlang and in C is to get
the order
of arguments wrong. So why isn't Mr "Erlang sucks" complaining
bitterly
about how C and Java use different terminators after the last
argument ")"
and all the others ",", making it hard to swap arguments?
Presumably he
isn't complaining about that BECAUSE C and Java do the same
thing, so he
hasn't noticed it.
(3) For what it's worth, my text editor, modelled on Emacs, but
originally
small enough to fit comfortably on a PDP-11, has a "swap terms"
command
that interchanges the closed terms on either side of the cursor.
Given
foo(X) ->
bar(X),^
ugh(X).
with the cursor where the ^ is, Ctrl-X t will convert this to
foo(X) ->
ugh(X),^
bar(X).
with no trouble at all. More generally, the DEdit editor in
Interlisp-D
had a nice facility: you could build up a stack of selections
and then
choose an operation, so you could
select thing one (except for its terminator)
select thing two (except for its terminator)
swap top selections
Gosh, I miss the ability to have multiple selections.
So this is arguably an EDITOR problem, not a LANGUAGE problem,
and it
can be addressed by more/better editor support. (Is there an XCode
plugin for Erlang?)
More information about the erlang-questions
mailing list