Boost logo

Boost :

From: Brey, Edward D (EdwardDBrey_at_[hidden])
Date: 2002-01-28 11:45:28

> From: Darin Adler [mailto:darin_at_[hidden]]
> But adding an "s" suffix doesn't make a word plural anyway in
> general, so
> this doesn't come up in my translatable programs.

True. That's not the best example, just what came to mind give "%1$s". The
point, though is that I've read and written a lot of context strings where
the placeholders run into the context to the point where readability is
significantly diminished. Brackets would have cured this.
> > You're in luck. C++ has this!
> > cout << "There's no space left on the disk named " << disk << ".";
> Perhaps you misunderstand. The string above goes into a
> translation database
> and is translated into each language my program works in. This was the
> subject of the motivating discussion at the outset of the
> format library
> debate. The stream example you list doesn't do that.
> Did you forget, or were you just ignoring this for the sake
> of the joke?

Indeed, I was ignoring that problem as well as several others.

> The situation with named function parameters and the tuple
> library are not
> analogous. The translators are dealing with the strings
> alone, not looking
> at the corresponding code.

Oh. I see what you're getting at. That would seem to justify adding a
comment feature. Perhaps something like this:

"There's no space left on the disk named [1|disk]."

where everything between the '|' and the ']' is a comment. It's not
perfect, because you still need to specify "disk" again programmatically as
an argument, but it's still nice for the translator.

> To clarify, I don't think a formatting library is as important if it
> duplicates the stream functionality with a different interface that is
> neither more suitable for translation nor compatible with
> printf. I want a
> formatting library suitable for translation. Others want one that is
> compatible with printf, and I think that's a nice idea too.

Functionality and compatibility are important, but they're not everything.
Readability, i.e. syntax, is important, too, otherwise, we'd all be using
Lisp for our OO programming. Consider all the operator void const*() casts
in the world. They don't add functionality. I don't know of any that were
added for compatibility. But, in general, I'm glad they're there.

Boost list run by bdawes at, gregod at, cpdaniel at, john at