[plt-scheme] prop:equal+hash for scheme/class ?
At Sat, 27 Dec 2008 21:16:27 -0600, Matthew Flatt wrote:
> At Sat, 27 Dec 2008 18:13:58 -0500, Felix Klock's PLT scheme proxy wrote:
> > Is there a prop:equal+hash for the scheme/class collection?
>
> Not currently.
>
> > Or perhaps instead of a property, there are a set of methods I am
> > supposed to override? (Much like how in Java one is supposed to make
> > sure that the hashCode() and equals(..) methods must be kept in
> > sync.) But if that is the case, the methods are not documented as far
> > as I can tell.
> >
> > The documentation for object% says that it "has no methods
> > fields" (sic) which leads me to think that PLT did not follow Java's
> > lead (that's good!) and so something more like prop:equal+hash (which
> > feels more like multi-method dispatch) is what belongs here.
>
> It would be easy to add an interface for `prop:equal+hash' along the
> same lines as the `printable<%>' interface for `prop:custom-write'. I'm
> open to other suggestions.
I've added `equal<%>' --- and also `interface*', so that other
properties can be mapped to interfaces without building them into
`scheme/class'.
The `equal<%>' interface is implemented with `interface*' and doesn't
need to be built in, but it seems useful enough to include in
`scheme/class'.
Matthew