Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] kprintf with user formatters
On Fri, 16 Jul 2004, Pierre Weis wrote:
> ``the application is a server which should run permanently'' ? Wao!
> May I suggest no to use Obj.magic too often for this kind of
> application ? Especially when you ``don't think that this hack will
> be too dangerous'': this hack could kill your server not too permanently!

Well, I suppose you don't want to imply that I should refrain from using
modules Printf and Format?  They are full of Obj.magic!  I have definitely
given it some thought whether there could be some kind of unsound use
of return values, but I didn't find anything, because unit-values are
always ignored.

Any other solution I have seen so far is much more complicated: it either
requires the use of a preprocessor, thunking or the use of lazy values
(I had already used them before - very unwieldy) or forces unnecessary
computations even if some action at the current log level shouldn't
be logged.

The only sufficiently efficient, elegant and safe solution would be to
introduce some kind of flag into the fprintf_out function in Printf so
that it doesn't call string conversion functions.  Or provide a dummy
function that just parses the format string and removes arguments.
This way a zprintf-function could be put into the interface.

Regards,
Markus

-- 
Markus Mottl          http://www.oefai.at/~markus          markus@oefai.at

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