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 SAA29493; Fri, 16 Jul 2004 18:52:41 +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 SAA28296; Fri, 16 Jul 2004 18:52:40 +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 i6GGqcSH032191; Fri, 16 Jul 2004 18:52:39 +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 i6GGqbDu003179; Fri, 16 Jul 2004 18:52:37 +0200 Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) id i6GGqbHF003178; Fri, 16 Jul 2004 18:52:37 +0200 Date: Fri, 16 Jul 2004 18:52:37 +0200 From: Markus Mottl To: Pierre Weis Cc: caml-list@inria.fr Subject: Re: [Caml-list] kprintf with user formatters Message-ID: <20040716165237.GB741@fichte.ai.univie.ac.at> Mail-Followup-To: Pierre Weis , caml-list@inria.fr References: <20040715093953.53769963@mostha> <200407160602.IAA00723@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200407160602.IAA00723@pauillac.inria.fr> User-Agent: Mutt/1.5.6i X-Miltered: at concorde with ID 40F807D6.002 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 ignores:01 fmt:01 printf:01 printf:01 fmt:01 val:01 val:01 extern:01 flags:01 prohibit:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 16 Jul 2004, Pierre Weis wrote: > No, this is not safe: you break the type system and create buggy > values like that. True, but unit values are not very useful so if the user ignores them (as usual), there won't be any problems. > # let log b fmt = > if b then Printf.printf fmt else > let rec f x = Obj.magic f in f fmt;; > val log : bool -> ('a, out_channel, unit) format -> 'a = > # log false "";; > - : unit = > # let x = log false "";; > val x : unit = > # Marshal.to_string;; > - : 'a -> Marshal.extern_flags list -> string = > # Marshal.to_string x [];; > Exception: Invalid_argument "output_value: abstract value (outside > heap)". > > There is clearly something wrong! Oh, come on, don't prohibit my use of Obj.magic by demonstrating strange interactions with the equally unsafe Marshal-module ;-) Btw., what has happened to generics? They were said to solve problems associated with type safety and I/O. Any intentions to put them into the experimental CVS-tree of OCaml? 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