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 OAA03748; Mon, 19 May 2003 14:06:47 +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 OAA05107 for ; Mon, 19 May 2003 14:06:46 +0200 (MET DST) Received: from mwinf0102.wanadoo.fr (smtp8.wanadoo.fr [193.252.22.30]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h4JC6kH00579 for ; Mon, 19 May 2003 14:06:46 +0200 (MET DST) Received: from debian (unknown [80.8.88.184]) by mwinf0102.wanadoo.fr (SMTP Server) with ESMTP id 2C6881BFFFBF for ; Mon, 19 May 2003 14:06:45 +0200 (CEST) Received: from moi by debian with local (Exim 3.36 #1 (Debian)) id 19HjPb-0000no-00 for ; Mon, 19 May 2003 14:06:39 +0200 To: caml-list@inria.fr Subject: Re: [Caml-list] kprintf question Mail-Copy-To: never From: Remi Vanicat Date: Mon, 19 May 2003 14:06:39 +0200 In-Reply-To: <20030519120056.5544c687.Damien.Pous@ens-lyon.fr> (Damien's message of "Mon, 19 May 2003 12:00:56 +0200") Message-ID: <87y913qgxc.dlv@wanadoo.fr> User-Agent: Gnus/5.090015 (Oort Gnus v0.15) Emacs/21.3 References: <20030519120056.5544c687.Damien.Pous@ens-lyon.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; caml-list:01 kprintf:01 damien:01 ens-lyon:01 printf:01 3.06:01 intuitively:01 abstr:01 prerr:01 endline:01 3.06,:01 faq:01 ocaml:01 caml:01 dept-info:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Damien writes: > hi, > > I've got three questions about Printf.kprintf : > > * why has it type > (string -> string) -> ('a, unit, string) format -> 'a > and not > (string -> 'b) -> ('a, unit, 'b) format -> 'a > > this would allow to make _exactly_ what we want within the > continuation. because 3.06 format type lack a fourth argument : Objective Caml version 3.06+31 (2003-05-02) # Printf.kprintf;; - : (string -> 'a) -> ('b, unit, string, 'a) format -> 'b = in 3.06 the fourth argument doesn't exist and is replaced by the third, but in the kprintf case, they are intuitively different (but they are intuitively equal in all other printf like function). (the fourth argument is needed for the %a format : # ("%a" : ('a, 'b, 'c, 'd) format);; - : (('a -> 'b -> 'c) -> 'b -> 'd, 'a, 'c, 'd) format = ) > * why is it _pseudo_ polymorphic ? > # Printf.kprintf (fun s -> prerr_endline s; "");; > - : ('_a, unit, string) format -> '_a = it is not kprintf problem, it is general problem : in ocaml 3.06, the result of an application cannot be polymorphic. It is a FAQ, read it. [...] -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat ------------------- 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