From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,NO_RELAYS autolearn=disabled version=3.1.3 Received: by yquem.inria.fr (Postfix, from userid 24253) id F1ABBBC69; Wed, 14 Nov 2007 19:43:53 +0100 (CET) Date: Wed, 14 Nov 2007 19:43:53 +0100 To: Alain Frisch Cc: Pierre Weis , caml-list Subject: Re: [Caml-list] Compiler feature - useful or not? Message-ID: <20071114184352.GB28796@yquem.inria.fr> References: <473A363F.2080301@gmail.com> <891bd3390711131608g48b584a4n6b0ccab95d7de3f3@mail.gmail.com> <20071114075827.GA24058@yquem.inria.fr> <473AEC04.3030303@frisch.fr> <20071114143524.GA4423@yquem.inria.fr> <473B249D.9040703@frisch.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <473B249D.9040703@frisch.fr> User-Agent: Mutt/1.5.9i From: weis@yquem.inria.fr (Pierre Weis) X-Spam: no; 0.00; compiler:01 weis:01 weis:01 wrote:01 abstract:01 abstract:01 clearer:01 integer:01 defines:01 caml-list:01 constraint:01 int:01 int:01 pierre:02 pierre:02 > Pierre Weis wrote: > >a private type is not an abstract type but a concrete type. > > I guess I got a wrong intuition of the new feature because of the "from" > function in your example. Is it the case that a value of type "abstract > int" can always be used as a value of type "int" automatically (you > mention that it is ok for pattern matching at least)? If we stick to the row example of positive values, we get: - a value of type row is in fact a concrete integer (it is not hidden in any way), - a value of type row can only be created by the make function defined in the implementation of the module that defines the private type, - a value of type row can be projected out of type row to a value of type int with a ``no-op'' identity function (I called it from in the example). So, no: a value of type row is not of type int and you need a marker to indicate the projection (for the time being the marker is a (identity) function call to let the implemention as simple as possible, but a sub-typing constraint makes sense and we can provide it if this is considered clearer). Best regards, -- Pierre