[erlang-questions] strictly less-than (Re: [erlang-questions] Ordered set and DETS)

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Thu Sep 9 13:34:11 CEST 2010

On Thu, Sep 9, 2010 at 5:58 AM, Richard O'Keefe <ok@REDACTED> wrote:
> In any case, we _can't_ drop term equality from Erlang, because it's an
> essential part of pattern matching.  Arithmetic equality, maybe.

Fun aside relating to this point: Standard ML defines specific types
as eqtypes or types which can be compared for equality. The 'real'
type of ML is not an eqtype because of the above mentioned trouble:
comparing two reals (IEEE FPs) for equality is almost often wrong. But
as Richard writes, this has ramifications for term equality. A term is
an eqtype iff all its primitive types are eqtypes and all composite
types are eqtypes. That is, you can have terms which you cannot
compare for equality with the '=' operator. For composite values, this
does not rule out partial pattern matches on only some components

The MosML implementation of SML get this wrong and allows reals to be
compared for equality. This also means that programs which compile in
MosML does not compile in other SML implementations. It has bitten me
more than once.


More information about the erlang-questions mailing list