caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* surprised by string_of_bool
@ 2008-05-27 23:10 Nathan Mishra Linger
  2008-05-28  8:02 ` [Caml-list] " David Allsopp
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Mishra Linger @ 2008-05-27 23:10 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 660 bytes --]

Consider the following transcript.

        Objective Caml version 3.10.0

# string_of_bool true == string_of_bool true;;
- : bool = true
# String.fill (string_of_bool true) 0 4 '@';;
- : unit = ()
# string_of_bool true;;
- : string = "@@@@"

Perhaps this has been discussed before, but I found this to be disturbing.
It seems easy enough to fix this problem, so that, for example, print_string
(string_of_bool true) always does the same thing.
The "correct" strategy seems to be used for string_of_float infinity:

# string_of_float infinity;;
- : string = "inf"
# string_of_float infinity == string_of_float infinity;;
- : bool = false

Nathan Mishra-Linger

[-- Attachment #2: Type: text/html, Size: 877 bytes --]

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

end of thread, other threads:[~2008-05-28  8:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-27 23:10 surprised by string_of_bool Nathan Mishra Linger
2008-05-28  8:02 ` [Caml-list] " David Allsopp
2008-05-28  8:14   ` Jon Harrop

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