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 LAA11247; Mon, 19 Jul 2004 11:00:35 +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 LAA11353 for ; Mon, 19 Jul 2004 11:00:34 +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 i6J90WSH021316; Mon, 19 Jul 2004 11:00:32 +0200 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA10974; Mon, 19 Jul 2004 11:00:32 +0200 (MET DST) From: Pierre Weis Message-Id: <200407190900.LAA10974@pauillac.inria.fr> Subject: Re: [Caml-list] kprintf with user formatters In-Reply-To: <20040716104231.5497af93@mostha> from Damien at "Jul 16, 104 10:42:31 am" To: Damien.Pous@ens-lyon.fr (Damien) Date: Mon, 19 Jul 2004 11:00:32 +0200 (MET DST) Cc: 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 40FB8DB0.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 marshalling:01 runtime:01 printf:01 printf:01 compiler:01 compiler:01 cristal:01 implementors:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk [...] > > # Marshal.to_string x [];; > > Exception: Invalid_argument "output_value: abstract value (outside > > heap)". > > > > There is clearly something wrong! > then, what about the following :-) > # Marshal.to_string (fun () -> ()) [];; > Exception: Invalid_argument "output_value: abstract value". As you may have guessed this is a completely different problem: marshalling functions is hard and had always be. It is no surprise we fail in this case. On the other hand, the value () is a basic one and had always been handled properly everywhere in the compiler and runtime: introducing a strange (if not buggy) behaviour for () is not desirable to say the least. > but it is not to hard to implement (after a quick look at printf.ml) > without the "invalid unit value" problem: The implementors will never accept to introduce an ``invalid unit value'' into the standard library. Thanks God, we never did so, and I'm pretty sure that if we had, the language and the compiler would not have the quality they have now. However, your solution does not solve the problem of the useless evaluation of the arguments of the call to printf. For that, you need the help of the compiler and a lazy construct and/or a flag of the compiler to pay nothing when you should not have to pay. 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