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 JAA04517; Fri, 16 Jul 2004 09:21:42 +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 JAA04698 for ; Fri, 16 Jul 2004 09:21:40 +0200 (MET DST) Received: from mproxy.gmail.com (mproxy.gmail.com [216.239.56.242]) by concorde.inria.fr (8.12.10/8.12.10) with SMTP id i6G7LcSH020319 for ; Fri, 16 Jul 2004 09:21:39 +0200 Received: by mproxy.gmail.com with SMTP id w29so1820046cwb for ; Fri, 16 Jul 2004 00:21:38 -0700 (PDT) Received: by 10.11.99.74 with SMTP id w74mr95034cwb; Fri, 16 Jul 2004 00:21:38 -0700 (PDT) Message-ID: Date: Fri, 16 Jul 2004 00:21:38 -0700 From: henri dubois-ferriere To: Pierre Weis Subject: Re: [Caml-list] kprintf with user formatters Cc: "Basile Starynkevitch [local]" , caml-list@inria.fr In-Reply-To: <200407160647.IAA02290@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <200407160647.IAA02290@pauillac.inria.fr> X-Miltered: at concorde with ID 40F78202.004 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; henridf:01 caml-list:01 kprintf:01 formatters:01 debugging:01 semantically:01 debugging:01 -noassert:01 printf:01 printf:01 kprintf:01 pierre:01 weis:01 pierre:01 weis:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > To go beyond that, we would need some help from the language that > would offer some provision for debugging from a special debug keyword, > semantically reminiscent to lazy and assert (as a kind of combined > semantics of both constructs). A compiler flag would then > automatically remove the debugging code (as is done for assert with > the -noassert flag) and the compiler will automatically insert the > (fun () -> ) as it already does in the case of lazy ... count one person at least who would be very interested in such a feature!! exactly for this purpose of log messages with varying debug levels. henri > > [...] > > Actually, I more and more hate printf, both in C and in Ocaml. I > > really believe it is a nightmare. > > Could you elaborate a bit ? We worked hard to provide a clean fully > typed interface to printf and, well ... we like using it :) > > We may have missed the point that makes your printf experience ``a > nightmare'', and having information on that could be helpful to > improve the implementation. > > > A possible suggestion might be to > > add a StopPrintf exception to Printf > > and > > add a tryprintf function to Printf, which takes a prologue function > > as an argument. If the prologue raises an exception, no formatting > > occur; otherwise, tryprintf works like kprintf > > I don't think the problem is in printf. The problem is in the way you > call printf (no printf variant could prevent evaluating the format > string and evaluating the arguments of its call: this is mandatory due > to the semantics of the language). > > > > 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 > ------------------- 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