English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

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 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