[plt-scheme] prop:equal+hash for scheme/class ?

From: Felix Klock's PLT scheme proxy (pltscheme at pnkfx.org)
Date: Sat Dec 27 18:13:58 EST 2008

PLT Scheme Folk-

Is there a prop:equal+hash for the scheme/class collection?

That is, I have learned how to extend PLT Scheme's equal? procedure to  
handle instances of particular struct types specially, via the  
prop:equal+hash property.  This has been incredibly useful for  
implementing abstract data types that integrate well with other code.   
I would like to know if there's an analogous property for classes.

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.

-Felix Klock

p.s. I saw in the documentation for scheme/class that one can override  
the inspector for a class, but that does not handle implementing  
abstract data types; consider e.g. the example I provided in pr 9987:


Posted on the users mailing list.