Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Implementation of lazy_t
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-11-10 (16:31)
From: Florian Lorenzen <florian.lorenzen@t...>
Subject: Implementation of lazy_t

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?

Thanks a lot and best regards,