From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 6C9E5BB81 for ; Wed, 11 Jan 2006 11:20:38 +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 k0BAKbxS000331 for ; Wed, 11 Jan 2006 11:20:38 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA24436 for ; Wed, 11 Jan 2006 11:20:37 +0100 (MET) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.192]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k0BAKaE8008127 for ; Wed, 11 Jan 2006 11:20:37 +0100 Received: by zproxy.gmail.com with SMTP id z3so113126nzf for ; Wed, 11 Jan 2006 02:20:36 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=chZj8M5nLc/cgx/nyCPgiwHYZQ23L01AM+ETiqPRgXpNpR0Msmy+qxS6y7PG5QuoYhDJ2gityZaqImHfXsLpe+AbuEcfaGTvVvAQ3wN727iDTNebGpyqsRhaVn86PjowClLnDpD/00lcbgpBnO3khmyuQxGYDPdXnLxnbBbrCn4= Received: by 10.65.124.13 with SMTP id b13mr151980qbn; Wed, 11 Jan 2006 02:20:36 -0800 (PST) Received: by 10.65.113.18 with HTTP; Wed, 11 Jan 2006 02:20:36 -0800 (PST) Message-ID: Date: Wed, 11 Jan 2006 03:20:36 -0700 From: Mackenzie Straight To: Alessandro Baretta Subject: Re: [Caml-list] let rec x = lazy x Cc: Ocaml In-Reply-To: <43C4D819.9080604@barettadeit.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <43C4D4F7.8090109@barettadeit.com> <43C4D819.9080604@barettadeit.com> X-Miltered: at concorde with ID 43C4DBF5.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 43C4DBF4.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 rec:01 lazy:01 baretta:01 baretta:01 barettadeit:01 barettadeit:01 -rectypes:01 libref:01 lazy:01 pointer:01 pointer:01 rec:01 wrote:01 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 Apologies for the duplicate, I forgot to send this to the list. On 1/11/06, Alessandro Baretta wrote: > Mackenzie Straight wrote: > > On 1/11/06, Alessandro Baretta wrote: > > > >>Strange as it may seem, it seems to work! With -rectypes enabled of cou= rse. > > > > http://caml.inria.fr/pub/docs/manual-ocaml/libref/Lazy.html > > > > You don't want to do this. > > I did it specifically because it is forbidden ;) Oh well in that case... a lazy value is a block with 1 field. Before the computation is forced, it's tagged Lazy_tag and contains a pointer to the closure to execute. Once forced, it becomes a forwarding pointer (Forward_tag) to the forced value. Thus, you would get a forwarding pointer which points to itself. The GC may then replace references to the forwarding pointer with its value. So, what you've got with let rec x =3D lazy x is a forwarding pointer that points to itself.