Browse thread
[Caml-list] kprintf with user formatters
- Damien
[
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: | 2004-07-19 (09:00) |
From: | Pierre Weis <pierre.weis@i...> |
Subject: | Re: [Caml-list] kprintf with user formatters |
[...] > > # Marshal.to_string x [];; > > Exception: Invalid_argument "output_value: abstract value (outside > > heap)". > > > > There is clearly something wrong! > then, what about the following :-) > # Marshal.to_string (fun () -> ()) [];; > Exception: Invalid_argument "output_value: abstract value". As you may have guessed this is a completely different problem: marshalling functions is hard and had always be. It is no surprise we fail in this case. On the other hand, the value () is a basic one and had always been handled properly everywhere in the compiler and runtime: introducing a strange (if not buggy) behaviour for () is not desirable to say the least. > but it is not to hard to implement (after a quick look at printf.ml) > without the "invalid unit value" problem: The implementors will never accept to introduce an ``invalid unit value'' into the standard library. Thanks God, we never did so, and I'm pretty sure that if we had, the language and the compiler would not have the quality they have now. However, your solution does not solve the problem of the useless evaluation of the arguments of the call to printf. For that, you need the help of the compiler and a lazy construct and/or a flag of the compiler to pay nothing when you should not have to pay. Best regards, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ ------------------- 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