From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 6C461BC88 for ; Sat, 29 Jan 2005 22:02:47 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j0TL2kaC001289 for ; Sat, 29 Jan 2005 22:02:46 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA24808 for ; Sat, 29 Jan 2005 22:02:46 +0100 (MET) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j0TL2iqO001285 for ; Sat, 29 Jan 2005 22:02:45 +0100 Received: from [192.168.1.200] (ppp205-248.lns1.syd3.internode.on.net [203.122.205.248]) by smtp3.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id j0TL2fc2047782; Sun, 30 Jan 2005 07:32:42 +1030 (CST) Subject: Re: [Caml-list] cyclic types From: skaller Reply-To: skaller@users.sourceforge.net To: brogoff Cc: caml-list In-Reply-To: References: <7f8e92aa0501290415321a8e46@mail.gmail.com> <6b8a914205012905427c79cd85@mail.gmail.com> Content-Type: text/plain Message-Id: <1107032560.23562.527.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 30 Jan 2005 08:02:41 +1100 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 41FBF9F6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41FBF9F4.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 sourceforge:01 wrote:01 wrote:01 abbreviation:01 -rectypes:01 ocaml:01 compiler:01 toplevel:01 -rectypes:01 rec:01 glebe:01 'and':98 061:98 nsw:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: On Sun, 2005-01-30 at 04:12, brogoff wrote: > On Sat, 29 Jan 2005, Remi Vanicat wrote: > > On Sat, 29 Jan 2005 14:15:43 +0200, Radu Grigore wrote: > > > Why are cyclic types forbidden? > > > > > > I was forced to use the definition: > > > type forest = Forest of forest StringMap.t | Empty > > > where I would have rather used > > > type forest = forest StringMap.t > > > The error is: > > > The type abbreviation tree is cyclic > > > > You can use the -rectypes of the ocaml compiler or toplevel to allow > > cyclic type. > > This comes up relatively frequently, and it is known that having -rectypes > as the default is not a good idea. However, wouldn't explicit typing of > this case sidestep the known problems and eliminate the need for a > -rectypes option here? Do you mean something like: type rec forest = forest StringMap.t where the 'rec' means 'just this type is meant to be cyclic' (and treat that type as if -rectypes had been given)? [or types, if there is an 'and' given] -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net