From: Mackenzie Straight <eizneckam@gmail.com>
To: Alessandro Baretta <a.baretta@barettadeit.com>
Cc: Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] let rec x = lazy x
Date: Wed, 11 Jan 2006 03:20:36 -0700 [thread overview]
Message-ID: <a7af81520601110220l60ef2042y6a1da0d38c7d0651@mail.gmail.com> (raw)
In-Reply-To: <43C4D819.9080604@barettadeit.com>
Apologies for the duplicate, I forgot to send this to the list.
On 1/11/06, Alessandro Baretta <a.baretta@barettadeit.com> wrote:
> Mackenzie Straight wrote:
> > On 1/11/06, Alessandro Baretta <a.baretta@barettadeit.com> wrote:
> >
> >>Strange as it may seem, it seems to work! With -rectypes enabled of course.
> >
> > 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 = lazy x is a forwarding pointer
that points to itself.
prev parent reply other threads:[~2006-01-11 10:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-11 9:50 Alessandro Baretta
2006-01-11 9:55 ` [Caml-list] " Mackenzie Straight
2006-01-11 10:04 ` Alessandro Baretta
2006-01-11 10:20 ` Mackenzie Straight [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a7af81520601110220l60ef2042y6a1da0d38c7d0651@mail.gmail.com \
--to=eizneckam@gmail.com \
--cc=a.baretta@barettadeit.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox