From: Pierre Weis <pierre.weis@inria.fr>
To: henri.dubois-ferriere@epfl.ch
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] printf arguments
Date: Fri, 21 Jun 2002 14:11:08 +0200 (MET DST) [thread overview]
Message-ID: <200206211211.OAA26886@pauillac.inria.fr> (raw)
In-Reply-To: <Pine.LNX.4.44.0206202008250.8947-100000@lcavpc41.epfl.ch> from Henri Dubois-Ferriere at "Jun 20, 102 08:12:46 pm"
> 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>
If cond then expr == if cond then expr else ()
[...]
> 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>
If you want to preserve the original typing of printf, you must
imperatively use a tail call to printf (due to the typing discipline
of string format).
Regards,
Pierre Weis
INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/
-------------------
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
prev parent reply other threads:[~2002-06-21 12:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-20 18:12 Henri Dubois-Ferriere
2002-06-21 12:11 ` Pierre Weis [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=200206211211.OAA26886@pauillac.inria.fr \
--to=pierre.weis@inria.fr \
--cc=caml-list@inria.fr \
--cc=henri.dubois-ferriere@epfl.ch \
/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