caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] printf and scanf
@ 2002-05-01 18:00 Francois-Rene Rideau
  2002-05-02  8:25 ` Jérôme Marant
  0 siblings, 1 reply; 9+ messages in thread
From: Francois-Rene Rideau @ 2002-05-01 18:00 UTC (permalink / raw)
  To: caml-list

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 | http://fare.tunes.org ]
[  TUNES project for a Free Reflective Computing System  | http://tunes.org  ]
Guns & bullets don't kill people -- blood loss and organ damage kills people.
-------------------
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


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [Caml-list] printf and scanf
@ 2002-04-30 13:51 Francois-Rene Rideau
  2002-05-01 16:06 ` Jérôme Marant
  2002-05-02  6:55 ` Francois Pottier
  0 siblings, 2 replies; 9+ messages in thread
From: Francois-Rene Rideau @ 2002-04-30 13:51 UTC (permalink / raw)
  To: caml-list

On Tue, 30 Apr 2002 12:22:49 +0000 (UTC), frappo wrote:
> Unfortunately, Danvy's encoding relies on the fact that
> the format specification is *not* a string.
Isn't camlp4 the obvious solution to this problem?
Format strings could "just" be processed at compile-time
by a camlp4 extension that produces a Danvy-style encoding
out of the format string.
Runtime processing of format string is more problematic,
but who needs that, anyway? Instead of concatenating format strings,
you'd directly use Danvy-style combinators.

Just my 2.e-7 kg of gold worth.

[ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ]
[  TUNES project for a Free Reflective Computing System  | http://tunes.org  ]
Mathematicians are like Frenchmen: whatever you say to them they
translate into their own language, and forthwith it is something
entirely different.
		-- Johann Wolfgang von Goethe
-------------------
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


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

end of thread, other threads:[~2002-05-03 10:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-01 18:00 [Caml-list] printf and scanf Francois-Rene Rideau
2002-05-02  8:25 ` Jérôme Marant
2002-05-02 16:11   ` Pixel
2002-05-02 17:50     ` Jérôme Marant
2002-05-02 17:09   ` John Prevost
2002-05-02 17:52     ` Jérôme Marant
  -- strict thread matches above, loose matches on Subject: below --
2002-04-30 13:51 Francois-Rene Rideau
2002-05-01 16:06 ` Jérôme Marant
2002-05-02  6:55 ` Francois Pottier

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