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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 1DB2CBC69 for ; Wed, 21 Mar 2007 10:01:48 +0100 (CET) Received: from will.iki.fi (will.iki.fi [217.169.64.20]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2L91jmV007056 for ; Wed, 21 Mar 2007 10:01:47 +0100 Received: from [10.0.20.131] (fa-3-0-0.fw.exomi.com [217.169.64.99]) by will.iki.fi (Postfix) with ESMTP id 3FCCC7D; Wed, 21 Mar 2007 11:01:45 +0200 (EET) In-Reply-To: <20070321131334.e381b5fb.mle+ocaml@mega-nerd.com> References: <20070321113430.f32c802a.mle+ocaml@mega-nerd.com> <87vegvv01u.fsf@pps.jussieu.fr> <20070321131334.e381b5fb.mle+ocaml@mega-nerd.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <6AF7E3A0-1A70-4381-B06E-13A8A887943C@exomi.com> Cc: caml-list@inria.fr Content-Transfer-Encoding: 7bit From: Ville-Pertti Keinonen Subject: Re: [Caml-list] Re: Why isn't -rectypes command line option the default Date: Wed, 21 Mar 2007 11:01:45 +0200 To: Erik de Castro Lopo X-Mailer: Apple Mail (2.752.3) X-Miltered: at concorde with ID 4600F479.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; -rectypes:01 recursive:01 -rectypes:01 2007,:98 wrote:01 rec:01 constructor:01 recursively:01 behaviour:01 caml-list:01 explicitly:01 explicitly:01 int:01 fib:01 variant:02 On Mar 21, 2007, at 4:13 AM, Erik de Castro Lopo wrote: > Wouldn't it be nicer to be able to specify the rectypes behaviour > per type? Maybe something like this would work: > > rec type 'a t = 'a * 'a t Lazy.t It would probably be possible to allow that by default with no extra keyword, since errors are unlikely when writing a type explicitly. But the ability to write recursive type aliases would not make actually creating recursively typed values all that convenient, you'd have to give the type explicitly (I'd rather just use a variant and a constructor). Note that in the example using -rectypes posted by Zheng Li, the type 'a t is never actually used for anything - presumably it's intended as an illustration to the reader, and could just as well be a comment - the type inferred for fib is compatible, but not named int t.