[racket] bug? bit-vector equal problem

From: Greg Hendershott (greghendershott at gmail.com)
Date: Tue Aug 19 22:44:33 EDT 2014

I can repro it on 6.1.0.3.

Looking at bit-vector.rkt, it seems the problem might be the "TODO"
comment here:

(serializable-struct bit-vector (words size)
  ....
  #:methods gen:equal+hash
  [(define (equal-proc x y recursive-equal?)
     (let ([vx (bit-vector-words x)]
           [vy (bit-vector-words y)]
           [nx (bit-vector-size x)]
           [ny (bit-vector-size y)])
       (and (= nx ny)
            (for/and ([index (in-range (- (bytes-length vx) 1))])
              (eq? (bytes-ref vx index)
                   (bytes-ref vy index)))
            ; TODO: check last word
            )))
  ....

But, you say, you're using equal? Although I'm not familiar with
gen:equal+hash, it must be that equal? checks for and uses that.

(I say "must" because I know that equal? always returns #f for a non
#:transparent struct. Since you're getting #t, at all, it can't be
plain equal?.)

Posted on the users mailing list.