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 MAA17367; Mon, 19 Jul 2004 12:10:40 +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 MAA16880; Mon, 19 Jul 2004 12:10:39 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6JAAVEV031860; Mon, 19 Jul 2004 12:10:31 +0200 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA17211; Mon, 19 Jul 2004 12:10:31 +0200 (MET DST) From: Pierre Weis Message-Id: <200407191010.MAA17211@pauillac.inria.fr> Subject: Re: [Caml-list] kprintf with user formatters In-Reply-To: <20040716174453.GD741@fichte.ai.univie.ac.at> from Markus Mottl at "Jul 16, 104 07:44:53 pm" To: markus@oefai.at (Markus Mottl) Date: Mon, 19 Jul 2004 12:10:31 +0200 (MET DST) Cc: pierre.weis@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 nez-perce with ID 40FB9E17.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 threads:01 mutexes:01 messed:01 threads:01 thunks:01 verbosity:01 implemented:01 camlp:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk [...] > > Moreover, this solution is general enough to accomodate threads, > > side effects, or whatever. > > You always need mutexes if you want to prevent that your output gets > messed up by multiple threads. Using thunks, the mutex handling can be done into the log function around the tunk call. > > To me the (fun () -> ) additional verbosity is not so bad: it clearly > > emphasizes that nothing at all is evaluated when logging is unnecessary. > > It's rather the other way round: people using format strings may get > the wrong idea that arguments are not converted if there is no output. They also can have the wrong idea that arguments are not evaluated (since there is no need to convert them to string) which is wrong. [...] > I don't think it is necessary or even useful to introduce new keywords. You are right in general, but in this case we have to deal with a notion that should change the evaluation regime of some expressions. This cannot be implemented without the help of the compiler. > A customized, beautiful solution would be possible with camlp4, thunks > solve the problem semantically, but look ugly, That why I propose to use something similar to assert and lazy: to get a simple way to express this semantics. > and some support for a kind of zprintf would be ideal :-) I'm afraid this would not solve the lazyness problem. 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