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.4 required=5.0 tests=SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 2599FBC6C for ; Thu, 31 Jan 2008 20:29:04 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAMKwoUfRVYT2dWdsb2JhbACQHwEKCCQFl2ls X-IronPort-AV: E=Sophos;i="4.25,286,1199660400"; d="scan'208";a="6792752" Received: from discorde.inria.fr ([192.93.2.38]) by mail2-smtp-roc.national.inria.fr with ESMTP; 31 Jan 2008 20:29:04 +0100 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m0VJT3JI015664 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 31 Jan 2008 20:29:03 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAMKwoUfRVYT2dWdsb2JhbACQHwEKCCQFl2ls X-IronPort-AV: E=Sophos;i="4.25,286,1199660400"; d="scan'208";a="6792751" Received: from an-out-0708.google.com ([209.85.132.246]) by mail2-smtp-roc.national.inria.fr with ESMTP; 31 Jan 2008 20:29:03 +0100 Received: by an-out-0708.google.com with SMTP id c24so186521ana.97 for ; Thu, 31 Jan 2008 11:29:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=fztPR5Exldqj9JggGCUw+IVof+nfHViZWIQRPoMSOew=; b=Ji1ISbPmidOZ7U+6bf4On/lfi6/E9gJQnYl6nnqsModq5JfONNdvhOcWKHLGnMd+3MQbPDayqLODx+dvSCpWmx7cSBhQS8xoWRYXJY7mgM6frfAiNxJTd80pw4uX3/E//mppqjNakHCZud9gq2KP1w0/HpRvITkqBAaQefzaUoM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=TDRpH2gOgPATTwSTvh78OAiXqw4BJ1Xv+r14lWLsbxpRQQp0RiYBgMq2VgHcT37wClFel5P/CEOKBm2aOlm3oTCzwr3/56GavSF7eniiHXpzFAnbi/IsRGCTI8rwVy8xKZSevYOCGTEolRFxhfx9+eqnSl5/KTCPDxxrLDB+dE8= Received: by 10.100.227.20 with SMTP id z20mr5219883ang.74.1201807741998; Thu, 31 Jan 2008 11:29:01 -0800 (PST) Received: by 10.100.136.12 with HTTP; Thu, 31 Jan 2008 11:29:01 -0800 (PST) Message-ID: Date: Thu, 31 Jan 2008 20:29:01 +0100 From: "=?ISO-8859-1?Q?St=E9phane_Lescuyer?=" Sender: steki.kun@gmail.com To: "Hezekiah M. Carty" Subject: Re: [Caml-list] Attach an invariant to a type Cc: "Romain Bardou" , caml-list In-Reply-To: <3a360f590801311113o4db1d660s206e7af4bcb3226@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <47a1cd167921b@wp.pl> <47A1D212.3010205@lri.fr> <1201802294.6154.56.camel@Blefuscu> <47A20FC1.5040103@lri.fr> <3a360f590801311113o4db1d660s206e7af4bcb3226@mail.gmail.com> X-Google-Sender-Auth: e150a83daed0b586 X-Miltered: at discorde with ID 47A2217F.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lri:01 0.02:98 wrote:01 integer:01 caml-list:01 int:01 int:01 variant:02 variant:02 seems:03 constructing:04 guess:04 types:05 types:05 problem:05 On Jan 31, 2008 8:13 PM, Hezekiah M. Carty wrote: > > This code does not work for me. I get a "This fixed type is not an > object or variant" error on the "type t =3D private int" line. From the > manual it looks like you would have to use something like this: > > type t =3D private Index of int > > to take advantage of private types. Am I missing something? > No you're not :) as far as I know, a private type can only be a record or a variant. It prevents one from constructing values of this type, but still allows pattern-matching on these values. I guess that making types like "int" private would require the system (among other things) to decide whether you're using a given integer as a Subindex.t or not. At first glance, it seems it is a harder problem than just forbidding the construction of any value of a given type. Just my 0.02=80 :-) St=E9phane L.