You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5087 Reporter:@yallop Assigned to:@alainfrisch Status: closed (set by @xavierleroy on 2013-08-31T10:43:58Z) Resolution: won't fix Priority: normal Severity: minor Version: 3.12.0+beta1 or 3.12.0+rc1 Category: ~DO NOT USE (was: OCaml general) Monitored by:@glondu "Julien Signoles" @hcarty
Bug description
Given the following signature,
module type E =
sig
type a
val v : a
end
the following expression evaluates to 'true':
let m = (module struct type a = int let v = 0 end : E)
and n = (module struct type a = float list let v = [] end : E) in
m = n
It seems undesirable for the combination of polymorphic equality and first-class modules to expose representations in this way.
The text was updated successfully, but these errors were encountered:
I agree this is an undesirable property. A clean fix would consist in wrapping packaged modules into a block with a unique id and the same tag as object blocks; we would then have the polymorphic equality coincide with the physical one for packages modules (the physical identity being defined by the packing site), and there would be a clean total ordering as well. The overhead would not be completely negligible for some uses of first-class modules, though.
Another, more lightweight solution, would attach a special tag to the runtime representation of structures (even when not packaged as first class values). This way, packing and unpacking would remain no-ops at runtime. The polymorphic comparison function would simply fail on this special tag (in the same way it fails for functional or external values).
As a side note, exceptions have exactly the same problem:
exception A of int;;
let x = A 0;;
exception A of float list;;
let y = A [];;
x = y;; (* true *)
Original bug ID: 5087
Reporter: @yallop
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2013-08-31T10:43:58Z)
Resolution: won't fix
Priority: normal
Severity: minor
Version: 3.12.0+beta1 or 3.12.0+rc1
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @glondu "Julien Signoles" @hcarty
Bug description
Given the following signature,
module type E =
sig
type a
val v : a
end
the following expression evaluates to 'true':
let m = (module struct type a = int let v = 0 end : E)
and n = (module struct type a = float list let v = [] end : E) in
m = n
It seems undesirable for the combination of polymorphic equality and first-class modules to expose representations in this way.
The text was updated successfully, but these errors were encountered: