[erlang-questions] erlang sucks
Ulf Wiger (TN/EAB)
ulf.wiger@REDACTED
Wed Mar 12 08:42:02 CET 2008
Robert Virding skrev:
>
> It would actually be possible to extend 'if' to allow non-guard tests
> and user defined boolean functions in the test. Like in lisp. It would
> be almost backwards compatible in that existing code would behave the
> same, BUT there would be one fundamental difference for other tests. As
> the tests in 'if' are guard tests then type errors just equate to
> failure of the guard while an error in a non-guard test function (user
> or otherwise) would result in an error being generated for the whole
> 'if' and function. Catching errors in the test would probably be
> expensive (Björn?) and in some way break Erlang semantics in adding
> implicit 'try's.
>
> But the resulting 'if' would definitely be more useful.
If there's such a dire need for an if-like construct with
slightly different semantics than the existing 'if', let's
not break existing code by changing 'if', but rather adding
(bloat) another construct. Perhaps we should call it 'switch',
and make it almost like a C switch, but subtly different in
creative ways? (:
The 'if' statement is not high on my list of things that need
improving. It's actually quite ok, except it could perhaps have
been named differently, in order not to give people false
expectations.
BR,
Ulf W
More information about the erlang-questions
mailing list