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
[Caml-list] kprintf with user formatters
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-07-19 (09:32)
From: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@l...>
Subject: Re: [Caml-list] kprintf with user formatters

Pierre Weis writes:
 > This does not solve the problem of evaluating the argument(s) of the logging
 > application. Consider the example I gave:
 > >  log 2 (fun () ->
 > >    eprintf "Argument 1 is hard to compute %d\n" (ackermann x x))
 > Your solution would lead to
 >  if_debug2 eprintf "Argument 1 is hard to compute %d\n" (ackermann x x)
 > which wastes is too much computing power when the debug turn out to be
 > off.

This is indeed  right, in the general case. However the  way I use it,
all  the computation  is  always  within a  function  being the  first
argument of a printf %a, and  thus not evaluated (as in the print_tree
example I gave).


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: