principle of least surprise

mbj@REDACTED mbj@REDACTED
Tue Nov 22 09:41:13 CET 2005


Raimo Niskanen <raimo@REDACTED> wrote:
> I guess your radical suggestions to change precedence for
> 'and' and 'or', or to remove 'orelse' and also 'andalso'
> are out of the question, for backwards compatibility 
> reasons.

Do you really think that changing precedence for and/or will break old
code?

As for andalso and orelse, I realize that it probably won't happen,
but if it did, is it really such a big thing?  A large project would
bring in the new erlang and recompile, and then the compiler would
complain.  It's trivial to change the code (if precedence for or/and
is changed).  Or maybe you could use some flag to the compiler which
could be used for old code?

> What about allowing 'orelse' and also 'andalso' in guards?
> That will probably happen one day.

Better than nothing of course, but wouldn't it be great to fix this
mis-feature and make the language better?


/martin



More information about the erlang-questions mailing list