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 PAA26477; Thu, 15 Jul 2004 15:45:33 +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 PAA26627; Thu, 15 Jul 2004 15:45:32 +0200 (MET DST) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i6FDjVSH029566; Thu, 15 Jul 2004 15:45:31 +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 i6FDjUDu015782; Thu, 15 Jul 2004 15:45:30 +0200 Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) id i6FDjUQh015781; Thu, 15 Jul 2004 15:45:30 +0200 Date: Thu, 15 Jul 2004 15:45:30 +0200 From: Markus Mottl To: "Basile Starynkevitch [local]" Cc: caml-list@inria.fr Subject: Re: [Caml-list] kprintf with user formatters Message-ID: <20040715134530.GC11971@fichte.ai.univie.ac.at> Mail-Followup-To: "Basile Starynkevitch [local]" , caml-list@inria.fr References: <20040630183237.457317c7@mostha> <200407142110.XAA25344@pauillac.inria.fr> <20040715001758.GF26614@fichte.ai.univie.ac.at> <20040715093953.53769963@mostha> <20040715121945.GA11971@fichte.ai.univie.ac.at> <20040715124223.GA28587@bourg.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040715124223.GA28587@bourg.inria.fr> User-Agent: Mutt/1.5.6i X-Miltered: at concorde with ID 40F68A7B.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 basile:01 behave:01 strangely:01 unsafely:01 camlp:01 sourceforge:01 poesia:01 poesiasoft:01 runtime:01 preprocessor:02 mottl:02 mottl:02 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. 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? > 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. 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