guile-user
[Top][All Lists]
Advanced

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

Re: goops and equal?


From: Mark H Weaver
Subject: Re: goops and equal?
Date: Tue, 11 Nov 2014 11:17:31 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Jan Nieuwenhuizen <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]