From: Mauricio Fernandez <mfp@acm.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Implementation of lazy_t
Date: Mon, 10 Nov 2008 18:12:29 +0100 [thread overview]
Message-ID: <20081110171229.GC803@NANA.localdomain> (raw)
In-Reply-To: <491861D3.8020709@tu-berlin.de>
On Mon, Nov 10, 2008 at 05:31:15PM +0100, Florian Lorenzen wrote:
> Hello,
>
> I would like to know how lazy datatype constructors are implemented in
> OCaml. A look into the documentation of the Lazy module revealed that
> the compiler uses a built-in type constructor lazy_t for this
> purpose. Unfortunately, I could not find any information on lazy_t on
> the web. My question is how lazy datatypes are handled internally
> (without having to read the compiler's source code). Especially, if
> lazy_t implements call-by-need in the sense that once evaluated
> objects are not evaluated again (by means of sharing) or if it
> implements call-by-name like one can do by inserting 0-ary lambda
> abstractions in the constructor to suspend evaluation and applying
> them to force evaluation?
>
> Is there any documentation on the internals available or can someone
> shine some light on this?
See stdlib/camlinternalLazy.ml --- force takes but 6 lines of code.
--
Mauricio Fernandez - http://eigenclass.org
next prev parent reply other threads:[~2008-11-10 17:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-10 16:31 Florian Lorenzen
2008-11-10 17:01 ` [Caml-list] " David Teller
2008-11-10 17:12 ` Mauricio Fernandez [this message]
2008-11-11 6:35 ` Andrej Bauer
2008-11-13 10:22 ` Florian Lorenzen
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=20081110171229.GC803@NANA.localdomain \
--to=mfp@acm.org \
--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