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=1.0 required=5.0 tests=AWL,DNS_FROM_SECURITYSAGE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id AFF45BB84 for ; Thu, 30 Oct 2008 21:18:39 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsUAABuzCUlRZ90xkWdsb2JhbACKGIlzAQEBAQkLCgcRA7g9g1E X-IronPort-AV: E=Sophos;i="4.33,517,1220220000"; d="scan'208";a="18696693" Received: from mtaout03-winn.ispmail.ntl.com ([81.103.221.49]) by mail3-smtp-sop.national.inria.fr with ESMTP; 30 Oct 2008 21:18:39 +0100 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20081030201838.RKVE14139.mtaout03-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com> for ; Thu, 30 Oct 2008 20:18:38 +0000 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20081030201838.DTMB21638.aamtaout02-winn.ispmail.ntl.com@romulus.metastack.com> for ; Thu, 30 Oct 2008 20:18:38 +0000 Received: from countertenor (dynamic86.vpdn.csx.cam.ac.uk [131.111.7.86]) (authenticated bits=0) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id m9UKIXD3019803 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Thu, 30 Oct 2008 20:18:35 GMT From: "David Allsopp" To: "OCaml List" Subject: Private types Date: Thu, 30 Oct 2008 21:18:31 +0100 Organization: MetaStack Solutions Ltd. Message-ID: <340C8DB35D244173AE527238DB359A19@countertenor> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: Ack6zK0k8Vd4heUbT8aHJHcmzfmMvQ== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Scanned-By: MIMEDefang 2.64 on 81.102.132.74 X-Cloudmark-Analysis: v=1.0 c=1 a=3kv09hzKW981-k2HHa0A:9 a=hfNieqUIsoptizfVsuObdHMQXSUA:4 a=CWfAmLVWKswA:10 X-Spam: no; 0.00; ocaml:01 sig:01 val:01 struct:01 int:01 int:01 declaration:02 string:02 module:03 module:03 let:03 let:03 types:05 types:05 i'm:09 I'm trying to play with the new private type abbreviations in OCaml 3.11+beta1 If I write: module type S = sig type t = private int val create : int -> t end;; module M : S = struct type t = int let create x = x end;; let x = M.create 0;; Shouldn't I now be able to say: string_of_int x;; But I get a type error... I'm struggling to see what difference the private declaration has made, therefore. I thought that the point of private types was that you could deconstruct them... so values of type M.t are valid wherever an int is used but not the converse. Or have I missed something? David