Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Francois-Rene Rideau <fare@t...>
Subject: [Caml-list] printf and scanf
Jerome Marant wrote:
  There are some cases where you may know the format string
  only at runtime; the most obvious example is internationalization
  through something like gettext.

Rather, the format strings are known at compile-time,
but you don't know which string will be used.
So you can precompile all strings, and
select the right formatter at run-time.

Even if you want to do things at runtime, you can compile the default
string at compile-time, and then you know the type to expect.
Switching strings can then be done in a type-safe way: throw an exception
if the type of the replacement string's compiled printer doesn't match.
You'll need this type of mechanism, anyway.

[ François-René ÐVB Rideau | Reflection&Cybernethics | ]
[  TUNES project for a Free Reflective Computing System  |  ]
Guns & bullets don't kill people -- blood loss and organ damage kills people.
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: