string variables in Printf.* calls: Bug, or lack of understanding?

From: T. Kurt Bond (thomas.k.bond@cpmx.saic.com)
Date: Thu Feb 13 1997 - 19:31:02 MET


Date: Thu, 13 Feb 1997 13:31:02 -0500
Message-Id: <199702131831.NAA22295@abetti>
From: "T. Kurt Bond" <thomas.k.bond@cpmx.saic.com>
To: caml-list@pauillac.inria.fr
Subject: string variables in Printf.* calls: Bug, or lack of understanding?

Hello,

[I apologize for the lack of a French version of this message.]

I recently observed the following while runing Objective Caml under
Windows NT and UnixWare 1.1:

            Objective Caml version 1.03

[1] # let s = "%f" in Printf.printf s 10.5;;
    Characters 30-31:
    This expression has type string but is here used with type
      ('a, out_channel, unit) format

[2] # Printf.printf "%f" 10.5;;
    10.500000- : unit = ()

I don't understand why the variable s, which is bound to a string value,
causes the error in statement 1, while using a literal string in
statement 2 works as expected. Can anyone explain? Or is this a bug?

-- 
T. Kurt Bond, Thomas.K.Bond@cpmx.saic.com



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:09 MET