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 IAA01561; Fri, 16 Jul 2004 08:18:06 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id IAA00535; Fri, 16 Jul 2004 08:18:05 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i6G6HvSH013303; Fri, 16 Jul 2004 08:17:58 +0200 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id IAA00699; Fri, 16 Jul 2004 08:17:57 +0200 (MET DST) From: Pierre Weis Message-Id: <200407160617.IAA00699@pauillac.inria.fr> Subject: Re: [Caml-list] kprintf with user formatters In-Reply-To: <20040715134530.GC11971@fichte.ai.univie.ac.at> from Markus Mottl at "Jul 15, 104 03:45:30 pm" To: markus@oefai.at (Markus Mottl) Date: Fri, 16 Jul 2004 08:17:57 +0200 (MET DST) Cc: basile.starynkevitch@inria.fr, caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 40F77315.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; pierre:01 weis:01 pierre:01 weis:01 caml-list:01 kprintf:01 formatters:01 basile:01 behave:01 strangely:01 unsafely:01 debugger:01 compiler's:01 camlp:01 sourceforge:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > On Thu, 15 Jul 2004, Basile Starynkevitch [local] wrote: > > I don't understand what this zprintf function should be, > > It should parse the format string, and ignore format arguments following > it. > > > but the above > > log proposal behave strangely (and perhaps unsafely) : > > > > # log false "a=%d s=%S\n%!" 1 "xyz";; > > - : unit = > > The reason for this is that it returns a function and not a unit value. > Unless you parse the format string, there is no way you can know when > to stop eating arguments to return a value. That's the debugger view of the problem :) The Caml compiler's view is simpler: you broke the type system, you get wrong results! > I don't think that this hack will be too dangerous. You might get an > exception 'Invalid_argument "equal: functional value"' if you want to > compare those fancy unit-values, which is about the worst thing you > can achieve. But who would want to compare unit-values anyway? I have no time to try and find a way to get a bus error with that one but I would not be glad to use software based on such a ugly hack that is not proved harmless in any case. > > For what it's worth, long time ago, I ended writing a camlp4 extension > > for a similar logging (or tracing purpose) see file README.trace and > > pa_trace.ml of > > http://cvs.sourceforge.net/viewcvs.py/poesia/PoesiaSoft/PoesiaMonIcap/ > > The preprocessor is not good enough for me. I would like to change > log levels at runtime, because the application is a server which should > run permanently. ``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! Best regards, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ ------------------- 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