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: Pixel <pixel@m...>
Subject: Re: [Caml-list] printf and scanf
Jérôme Marant <> writes:

> I've been giving the following example for quite long now: languages
> do not always order words the same way. So, sometimes, you need to
> reorder parameters in translated strings in order to get a correct
> syntax in the targeted language. With printf, you can do it this way:
> fr: " %s %d"
> string -> int
> de: " %2$s %1$d"
> int -> string
> This example shows that if you want a full featured internationalisation,
> you cannot state that "you know the type you expect" since you will only
> determine it at run-time.

this only shows that " %2$s %1$d" is not a valid translation of " %s %d",
since they do not have the same type, and would fail at runtime (using this in
C would give you a segfault).

" %2$d %1$s" with type "string -> int" is a valid translation of " %s %d"

this means that not checking the translations could lead to a hole in the type
system, and so printf must be prepared to detect type errors (which it
currently does :)
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: