From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 5C9F7BC57 for ; Mon, 1 Mar 2010 11:55:17 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.49,559,1262559600"; d="scan'208";a="53785524" Received: from aspirine.inria.fr (HELO [128.93.60.41]) ([128.93.60.41]) by mail1-relais-roc.national.inria.fr with ESMTP; 01 Mar 2010 11:55:17 +0100 Message-ID: <4B8B9D15.7070300@glondu.net> Date: Mon, 01 Mar 2010 11:55:17 +0100 From: =?UTF-8?B?U3TDqXBoYW5lIEdsb25kdQ==?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) MIME-Version: 1.0 To: guillaume.yziquel@citycable.ch Cc: OCaml List Subject: Re: [Caml-list] Recursive subtyping issue References: <4B887AED.3090005@citycable.ch> <4B88F32C.3050701@citycable.ch> <87k4tyoq3m.fsf@frosties.localdomain> <4B891A0C.604@citycable.ch> <76EDF2F2-8B02-4C97-B083-EC74630D8ECA@mpi-sws.org> <4B896026.2070805@citycable.ch> <4B89780E.5080305@citycable.ch> <4B898179.1000600@citycable.ch> In-Reply-To: <4B898179.1000600@citycable.ch> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; recursive:01 subtyping:01 guillaume:01 untyped:01 untyped:01 val:01 val:01 cheers:01 phane:98 steph:98 phane:98 abstract:01 caml-list:01 module:03 let:03 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 = >> # let g : obj -> 'a t = fun x -> (x : obj :> 'a t);; >> val g : obj -> 'a t = >> # 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