Browse thread
Recursive subtyping issue
[
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: | 2010-03-01 (10:55) |
From: | Stéphane Glondu <steph@g...> |
Subject: | Re: [Caml-list] Recursive subtyping issue |
Guillaume Yziquel a écrit : >> # type untyped;; >> type untyped >> # type 'a typed = private untyped;; >> type 'a typed = private untyped >> # type -'typing tau = private obj >> and 'a t = 'a typed tau >> and obj = private untyped tau;; >> type 'a tau = private obj >> and 'a t = 'a typed tau >> and obj = private untyped tau >> # let f : 'a t -> obj = fun x -> (x : 'a t :> obj);; >> val f : 'a t -> obj = <fun> >> # let g : obj -> 'a t = fun x -> (x : obj :> 'a t);; >> val g : obj -> 'a t = <fun> >> # Why don't you just declare 'a t to be synonym for obj in the implementation of your module, declare them as abstract in its interface, and export the specially typed identities f and g? Cheers, -- Stéphane