principle of least surprise

Ulf Wiger (AL/EAB) ulf.wiger@REDACTED
Tue Nov 22 10:43:07 CET 2005


 
Nick Linker wrote:
>
> Hm, what, in your opinion, about the possibility to be an 
> arbitrary function (returning true or false, of course) in 
> guards? Will it make the language better?

The problem of that obviously is that normal erlang functions
can contain side-effects, loops, and all sorts of scary stuff.

Haskell has 'monads', where all the scary stuff happens. Perhaps
Erlang should introduce 'anti-monads' where scary stuff _can't_
happen?

In "Wearing the hair shirt" 2003(*), Simon Peyton-Jones claimed
that the only thing wrong with monads was the name: they should
have called them "warm fuzzy things".

Now, the 'anti-monad' would truly be warm and fuzzy, and should
be allowable in guards (and most likely also in select patterns).

Erlang WFTs, in other words, would be the thing to allow in 
guards.  (:

/Uffe

(*)
http://research.microsoft.com/users/simonpj/papers/haskell-retrospective
/



More information about the erlang-questions mailing list