caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* printf "%a" vs sprintf "%a"
@ 2009-03-26 16:53 Tiphaine Turpin
  2009-03-26 17:29 ` [Caml-list] " David Rajchenbach-Teller
  2009-03-26 17:29 ` Jérémie Dimino
  0 siblings, 2 replies; 4+ messages in thread
From: Tiphaine Turpin @ 2009-03-26 16:53 UTC (permalink / raw)
  To: caml-list

Hi,

I'am confused by the interpretation of "%a":

# Printf.printf "%a";;
- : (out_channel -> '_a -> unit) -> '_a -> unit = <fun>
# Printf.sprintf "%a";;
- : (unit -> '_a -> string) -> '_a -> string = <fun>

Usually, the typing of formatting functions is such that

printf something

has type unit if and only if

sprintf something

has type string. But %a breaks this rule. Wouldn't it be simpler to have
two separate directives which accept respectively string printers and
channel printers, regardless of the outer printing function ?

Tiphaine


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-26 17:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-26 16:53 printf "%a" vs sprintf "%a" Tiphaine Turpin
2009-03-26 17:29 ` [Caml-list] " David Rajchenbach-Teller
2009-03-26 17:29 ` Jérémie Dimino
2009-03-26 17:37   ` Tiphaine Turpin

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).