In the following program, `(p? 1 1)` returns `#t` or `#f` depending on `p?` 
being called from the same or different module:

#lang racket

(module m racket
  (provide
    (contract-out
      [p? (parametric->/c (a) (a a . -> . boolean?))]))
  (define p? equal?)
  (p? 1 1))
  
(require 'm)
(p? 1 1)

Module `m` is wrong in the first place for comparing 2 sealed objects, but here 
we don't get an error. Is it practical to make `equal?` aware of parametric 
contracts?

This bit me in practice when I used a hashtable (which had an implicit 
`equal?`). The worse part was that tests passed because they were in the same 
module, and I only got unexpected behavior from outside.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to