AA with complex keytype?

Charles D Hixson charleshixsn at earthlink.net
Tue Feb 13 13:42:53 PST 2007


Stewart Gordon wrote:
>  <snip>
>
> So if x != y, then both x < y and y < x?  That wouldn't make sense at all.
> 
>> It should be easy to implement this as the default opCmp(Object).
> 
> OUAT, Object.opCmp was set up to compare the memory addresses, but this behaviour was removed to prepare for copying/compacting GC, and probably partly to eliminate the confusing behaviour it created.
> 
> Stewart.
> 

Actually, there are many cases where modular arithmetic to 
various bases is the desired behavior, and in such a system 
"both x < y and y < x" makes perfect sense.  You can reach ANY 
number by repeatedly incrementing and also by repeatedly 
decrementing.

OTOH, I'm not certain that these are worth building into a 
language.  Ada thought so, but no other language appears to 
have followed their lead.  (Possibly it was also done in 
Algol68 ... I never used it, but it contained all sorts of 
experimental things.)



More information about the Digitalmars-d mailing list