From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA30277; Fri, 16 Jul 2004 19:14:47 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA30528; Fri, 16 Jul 2004 19:14:46 +0200 (MET DST) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6GHEjEV014688; Fri, 16 Jul 2004 19:14:45 +0200 Received: from fichte.ai.univie.ac.at (markus@localhost [127.0.0.1]) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) with ESMTP id i6GHEiDu003669; Fri, 16 Jul 2004 19:14:44 +0200 Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) id i6GHEiO7003668; Fri, 16 Jul 2004 19:14:44 +0200 Date: Fri, 16 Jul 2004 19:14:44 +0200 From: Markus Mottl To: Pierre Weis Cc: caml-list@inria.fr Subject: Re: [Caml-list] kprintf with user formatters Message-ID: <20040716171444.GC741@fichte.ai.univie.ac.at> Mail-Followup-To: Pierre Weis , caml-list@inria.fr References: <20040715134530.GC11971@fichte.ai.univie.ac.at> <200407160617.IAA00699@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200407160617.IAA00699@pauillac.inria.fr> User-Agent: Mutt/1.5.6i X-Miltered: at nez-perce with ID 40F80D05.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 kprintf:01 formatters:01 pierre:01 weis:01 printf:01 unsound:01 unwieldy:01 fprintf:01 printf:01 parses:01 dummy:01 preprocessor:02 lazy:02 imply:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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