Hi,
Given two record types that are identical but in name, is it safe (if perhaps a poor idea) to cast between functions that are parametric in these record types:
e.g. Given,
module A =
struct
type t = {a:int}
end
module B =
struct
type t = {a:int}
end
Is this safe ?
module F(Ty: sig type t = {a:int} end) =
struct
let extract {Ty.a=x} = x
end
module F_A = F(A)
let y = {B.a=3}
(Obj.magic F_A.extract) y
Put another way: is the implementation of two records w/ identical labels the same, or is there a runtime significance to their static difference?
Thanks,
Yitzhak
--------------------------------------------------
Yitzhak Mandelbaum
AT&T Labs - Research