English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] printf arguments
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-06-20 (18:17)
From: Henri Dubois-Ferriere <henridf@l...>
Subject: [Caml-list] printf arguments
In trying to write a wrapper around printf for debug message logging, 
(a la syslog), I am coming across the following problem:

# let myprintf fmt = if (true) then Printf.fprintf stdout fmt;;
val myprintf : (unit, out_channel, unit) format -> unit = <fun>

# Printf.fprintf;;
- : out_channel -> ('a, out_channel, unit) format -> 'a = <fun>

so the myprintf function above does not have the same type as the original 
fprintf. Note that removing the if clause returns us to the proper type:

# let myprintf fmt = Printf.fprintf stdout fmt;;
val myprintf : ('a, out_channel, unit) format -> 'a = <fun>

Any clue why this is so, and how to get around it?



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