lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 11-Jun-07, at 4:19 PM, Steve Heller wrote:

I suppose so. But then perhaps there should be
different operators that behave like "<=", etc. with
respect to types, but for (in-)equality of values.
Maybe === and ~==? That would simplify problems like
the one I have.

Or am I (almost) the only one with this problem? If
so, then of course it doesn't make sense to change the
language to meet my peculiar needs.

Certainly there is an argument for the <> operator,
meaning "orders less or orders greater", which would
differ from ~= in that it would throw an error if
the arguments have no ordering relationship. (Consequently,
it would throw an error if you tried 2.0 <> NaN).

I doubt whether there would be enough use of it to
justify the (small) implementation cost, or the
(rather larger) documentation cost.

IEEE-745 contemplates a rather large collection of
ordering operations; few languages actually implement
them, though. As another datapoint, it is not uncommon
for languages to implement two or more "equality"
operators -- and the difference between these operators
often figures prominently in FAQ lists :)