[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-08-22 (18:33) |
From: | Yitzhak Mandelbaum <yitzhak@r...> |
Subject: | safe casting |
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 http://www.research.att.com/~yitzhak