Browse thread
[Caml-list] kprintf with user formatters
[
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-16 (07:21) |
From: | henri dubois-ferriere <henridf@g...> |
Subject: | Re: [Caml-list] kprintf with user formatters |
> To go beyond that, we would need some help from the language that > would offer some provision for debugging from a special debug keyword, > semantically reminiscent to lazy and assert (as a kind of combined > semantics of both constructs). A compiler flag would then > automatically remove the debugging code (as is done for assert with > the -noassert flag) and the compiler will automatically insert the > (fun () -> ) as it already does in the case of lazy ... count one person at least who would be very interested in such a feature!! exactly for this purpose of log messages with varying debug levels. henri > > [...] > > Actually, I more and more hate printf, both in C and in Ocaml. I > > really believe it is a nightmare. > > Could you elaborate a bit ? We worked hard to provide a clean fully > typed interface to printf and, well ... we like using it :) > > We may have missed the point that makes your printf experience ``a > nightmare'', and having information on that could be helpful to > improve the implementation. > > > A possible suggestion might be to > > add a StopPrintf exception to Printf > > and > > add a tryprintf function to Printf, which takes a prologue function > > as an argument. If the prologue raises an exception, no formatting > > occur; otherwise, tryprintf works like kprintf > > I don't think the problem is in printf. The problem is in the way you > call printf (no printf variant could prevent evaluating the format > string and evaluating the arguments of its call: this is mandatory due > to the semantics of the language). > > > > 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 > ------------------- 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