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 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 8F8D8BC69 for ; Sun, 6 May 2007 09:54:30 +0200 (CEST) Received: from smtp3-g19.free.fr (smtp3-g19.free.fr [212.27.42.29]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l467sUmu007117 for ; Sun, 6 May 2007 09:54:30 +0200 Received: from [192.168.0.1] (rke75-3-82-229-183-156.fbx.proxad.net [82.229.183.156]) by smtp3-g19.free.fr (Postfix) with ESMTP id E0B615E15C; Sun, 6 May 2007 09:54:29 +0200 (CEST) Message-ID: <463D89B5.5060309@inria.fr> Date: Sun, 06 May 2007 09:54:29 +0200 From: Alain Frisch User-Agent: Thunderbird 2.0.0.0 (X11/20070326) MIME-Version: 1.0 To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] beginner question: DAGs w/ recursive types an encapsulation of a Map References: <20070505025954.71b5a5b5@kerneis.info> <1ffe809c0705052033p6079116fq2a30f5dd942789aa@mail.gmail.com> <200705060439.41842.jon@ffconsultancy.com> In-Reply-To: <200705060439.41842.jon@ffconsultancy.com> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 463D89B6.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; frisch:01 frisch:01 recursive:01 compiler:01 -rectypes:01 compiler:01 run-time:01 libref:01 -rectypes:01 recursive:01 type-checker:01 ill-formed:01 run-time:01 type-checker:01 checker:01 Jon Harrop wrote: > # type tree' = int * (char * tree') list ;; > type tree' = int * (char * tree') list > > This is not "unsafe" in the usual sense of the word but it means that the > compiler will be less friendly on all of the rest of your code. The declaration is not "unsafe" by itself, but the -rectypes option is, in the sense that it will make the compiler accept programs that will produce infinite loops in the run-time system: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Lazy.html << Note: if the program is compiled with the -rectypes option, ill-founded recursive definitions of the form let rec x = lazy x or let rec x = lazy(lazy(...(lazy x))) are accepted by the type-checker and lead, when forced, to ill-formed values that trigger infinite loops in the garbage collector and other parts of the run-time system. Without the -rectypes option, such ill-founded recursive definitions are rejected by the type-checker. >> (One might argue that the type checker does not reject non-terminating programs anyway.) -- Alain