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-16 (17:14)
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.


Markus Mottl

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