[racket] equal? with classes and contracts

From: Nadeem Abdul Hamid (nadeem at acm.org)
Date: Tue Nov 30 22:32:30 EST 2010

I think something like this has come up before but I can't find the
thread. Given:

(define A%
  (class object% (inspect #f) (super-new)))
(define/contract B%
  (class/c )
  (class object% (inspect #f) (super-new)))

How can I get around the problem that:
    (equal? (new A%) (new A%))
but
    (not (equal? (new B%) (new B%)))

I want to be able to compare objects of the same contracted class for
structural equality.



And another question: is there something similar to struct-copy for
objects? Or a way to easily clone them?



--- nadeem


Posted on the users mailing list.