Browse thread
[Caml-list] Has laziness changed type?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Xavier Leroy <xavier.leroy@i...> |
| Subject: | Re: [Caml-list] Has laziness changed type? |
> I think I recall Lazy.t being defined in 3.04 as = Value of > ... | Exception of ... | Suspension of ... > or something of the sort. Now Lazy.t is defined simply as > lazy_t. But what *is* lazy_t exactly? An abstract type. You don't want to know :-) More seriously: in 3.06, the compiler and runtime system represent lazy values more efficiently; in particular, the "Value of" indirections present in 3.04 are now shortened by the GC whenever possible. As a consequence, the representation of lazy values no longer matches that of a Caml datatype. > Can I apply pattern-matching on it? No. The general "contract" of a lazy value is that you should never have to distinguish whether it's been evaluated already or not. Just perform Lazy.force on the lazy value and match on the result. - Xavier Leroy ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners