Jan Nieuwenhuizen <[email protected]> writes:
> In the example below, my implementation of equal? is only being
> used if both types are the same. That surprised me; the manual
> says equal? becomes a generic and for normal generics this works
> as I expect.
'equal?' is actually a "primitive generic", which means that it's a core
C function that handles the cases it knows about, and only calls out to
user-defined GOOPS methods for cases that aren't handled internally.
One of the facts known by core 'equal?' is that objects of different
types are not equal.
It may be that we should relax this somewhat, but IMO it's probably a
bad idea to allow instances of your user-defined type to be 'equal?' to
symbols. Out of curiosity, why do you want this?
BTW, in order to allow user-defined types to be 'equal?' to built-in
types, we'd also need to change our hashing function for 'equal?'-based
hash tables.
Regards,
Mark