principle of least surprise
Wed Nov 23 00:15:33 CET 2005
Kostis is right but he doesn't give the whole story. In the beginning
there was the void and when we filled the void with Erlang we thought
that guards should only be extensions to the basic pattern matching with
things like simple type tests etc. Logical expressions were not
envisioned. There we there were no problems with overlapping names and
we could use float/1 as a type test in guards and as a conversion
function in the body.
This broke with boolean type test functions. Instead of just having a
few is_X/1 we thought it better to have the full range and then
encourage people to use them in guards instead of the old X/1 versions.
I don't really see why people still use the old X/1 type tests, it's not
like we added the new ones yesterday. Especially not savvy users.
Kostis Sagonas wrote:
> > > Nor do I really see the point of two collections of
> > > nearly-identical type test primitives (is_X/1 vs X/1).
> > the question is better stated as why adding is_X/1 when there already
> > exists X/1?
>One of the reasons is the following:
>Eshell V5.5 (abort with ^G)
More information about the erlang-questions