On 08/18/2011 10:58 AM, Gabriel Scherer wrote:
I believe the comparison hardening was made desirable by the expected use of first-class modules to encode existential datatypes: with existential datatypes you may try to use the polymorphic comparison operators on two values of the same (existential) datatype having different internal representations. The problem didn't happen with the previous encoding of existential types using first-class polymorphism, as it implies packing the value inside closures, so the polymorphic comparison operators were not usable.
The problem existed before, because of exceptions. When two exception values having constructors with the same name are compared with the polymorphic equality, their arguments are compared structurally even if they don't have the same type. (One way to address this would be to have a special tag on exception values to force physical comparison of the constructors.)
-- Alain -- Caml-list mailing list. Subscription management and archives: https://sympa-roc.inria.fr/wws/info/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
