Version française
Home     About     Download     Resources     Contact us    
Browse thread
string variables in Printf.* calls: Bug, or lack of understanding?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: T. Kurt Bond <thomas.k.bond@c...>
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