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.0 required=5.0 tests=none 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 50468BC6C for ; Fri, 1 Feb 2008 11:00:25 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAG98okeCNhAB/2dsb2JhbACtcQ X-IronPort-AV: E=Sophos;i="4.25,289,1199660400"; d="scan'208";a="8604163" Received: from kurims.kurims.kyoto-u.ac.jp ([130.54.16.1]) by mail3-smtp-sop.national.inria.fr with ESMTP; 01 Feb 2008 11:00:23 +0100 Received: from localhost (silicon [130.54.16.72]) by kurims.kurims.kyoto-u.ac.jp (8.13.8/8.13.8) with ESMTP id m11A0HCk010174; Fri, 1 Feb 2008 19:00:18 +0900 (JST) Date: Fri, 01 Feb 2008 19:00:17 +0900 (JST) Message-Id: <20080201.190017.68537559.keiko@kurims.kyoto-u.ac.jp> To: thelema314@gmail.com Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Attach an invariant to a type From: Keiko Nakata In-Reply-To: <47A22F01.9070404@gmail.com> References: <47A226D7.6030108@wp.pl> <47A22F01.9070404@gmail.com> X-Mailer: Mew version 4.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; compilation:01 variants:01 compiler:01 weis:01 caml-list:01 caml-list:01 constructor:01 int:01 int:01 pierre:02 caml:02 declaration:02 checking:02 construct:02 explicit:04 Hello. > type t = private int isn't legal. Most types get completely erased > during compilation, but records and variants have code generated by the > compiler based off their type declaration to construct a value of that > type. A plain int doesn't have this compiler-generated constructor, so > it can't be private in this way. > > That said, I'd appreciate a simple system to do the kind of checking you > want at the site of an explicit typecast. Maybe a previous discussion on the list is interesting to you. Among this active discussion, the following post by Pierre Weis looks good new to you. http://caml.inria.fr/pub/ml-archives/caml-list/2007/11/76aa857050497ee6cf62db65eadd567a.en.html With best regards, Keiko