Should this be correct behaviour?

Janice Caron caron800 at googlemail.com
Thu Nov 29 23:37:52 PST 2007


On Nov 30, 2007 12:23 AM, Sean Kelly <sean at f4.ca> wrote:
> If NaNs compared not equal via
> TypeInfo comparisons

They don't compare not equal even in normal use. They compare as being
neither == nor !=.

(I know you know that. Just trying to be precise here).

> then any NaN used as an AA key would result in an
> insertion that was lost forever.  With this in mind, I think the current
> behavior makes the most sense as well.

There is another way of looking at it though. Using NaN as array key
sounds like a bug to me. Should it even be permitted? Let's think this
through - the interpretation of NaN here is either "unassigned
variable", or "I don't know the answer" (for example, infinity divided
by infinity). Is it even sensible to allow such a beast to be an array
key?



More information about the Digitalmars-d mailing list