Version française
Home     About     Download     Resources     Contact us    
Browse thread
log function without evaluate arguments
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] log function without evaluate arguments
Excerpts from tmp123's message of Tue Nov 06 18:05:48 +0100 2007:
> Hello,
> 
> In order to implement a function that prints log messages only, by
> example, if a boolean flag is true, and does nothing elsewhere, I've
> been reading the (long) post sequence "kprintf with user formatters"
> (2004 Jun 30).
> 
> In this context, "does nothing" means not convert parameters to text nor
> evaluate them.

Have a look to the Printf.ifprintf [1] function, it does exactly what you want.

Regards,

[1]:
val ifprintf : 'a -> ('b, 'a, unit) format -> 'b
(** Same as {!Printf.fprintf}, but does not print anything.
    Useful to ignore some material when conditionally printing. *)

-- 
Nicolas Pouillard aka Ertai