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 BAA19813; Fri, 16 Jul 2004 01:01:04 +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 BAA20010; Fri, 16 Jul 2004 01:01:03 +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 i6FN12SH001092; Fri, 16 Jul 2004 01:01:02 +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 i6FN11Du022475; Fri, 16 Jul 2004 01:01:01 +0200 Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) id i6FN11Bt022474; Fri, 16 Jul 2004 01:01:01 +0200 Date: Fri, 16 Jul 2004 01:01:01 +0200 From: Markus Mottl To: Pierre Weis Cc: caml-list@inria.fr Subject: Re: [Caml-list] kprintf with user formatters Message-ID: <20040715230101.GC20939@fichte.ai.univie.ac.at> Mail-Followup-To: Pierre Weis , caml-list@inria.fr References: <20040715001758.GF26614@fichte.ai.univie.ac.at> <200407152220.AAA18634@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200407152220.AAA18634@pauillac.inria.fr> User-Agent: Mutt/1.5.6i X-Miltered: at concorde with ID 40F70CAE.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 printf:01 invocation:01 evidently:01 invocation:01 behave:01 fprintf:01 formatter:01 formatter:01 null:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 16 Jul 2004, Pierre Weis wrote: > I don't know of any way to safely prevent the arguments of printf from > being converted to string when interpreting the format. This would probably require some changes in the implementation of Printf/Format. > Since you have a if then else, the ``???'' expression should have > exactly the same type as the ``then kfprintf ...'' expression. Hence > the simplest way to do so is to have another kfprintf invocation with > the same format. Evidently you want to redirect the output of this > invocation to /dev/null (I mean you do not want to see its output). Not only this: I want to prevent any computations associated with generating output strings. > The best way to do so is not to redefine a specialized version of > printf, it is simply to define a specialized pretty printer that would > behave as you want and then to specialize fprintf with it: > > let null_formatter = > let null_out s idx len = () in > let null_flush = ignore in > Format.make_formatter null_out null_flush;; This would surely ignore any output, but "null_out" would still be called with superfluously generated strings. Anyway, the argument-eating function that makes use of "Obj.magic" works for me so my problem is solved. 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