caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Remi Vanicat <vanicat@labri.u-bordeaux.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] kprintf question
Date: Mon, 19 May 2003 14:06:39 +0200	[thread overview]
Message-ID: <87y913qgxc.dlv@wanadoo.fr> (raw)
In-Reply-To: <20030519120056.5544c687.Damien.Pous@ens-lyon.fr> (Damien's message of "Mon, 19 May 2003 12:00:56 +0200")

Damien <Damien.Pous@ens-lyon.fr> 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 = <fun>

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 = <abstr>
)



> * why is it _pseudo_ polymorphic ?
> # Printf.kprintf (fun s -> prerr_endline s; "");;
> - : ('_a, unit, string) format -> '_a = <fun>

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


      reply	other threads:[~2003-05-19 12:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-19 10:00 [Caml-list] kprintf question (was printf question) Damien
2003-05-19 12:06 ` Remi Vanicat [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y913qgxc.dlv@wanadoo.fr \
    --to=vanicat@labri.u-bordeaux.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).