Boost logo

Boost :

From: Stewart, Robert (stewart_at_[hidden])
Date: 2002-01-29 08:16:46


From: mfdylan [SMTP:dylan_at_[hidden]]
>
> Re your comments about operator% having the "wrong" precedence, it's
> exactly this fact that makes operator% perfect, because
>
> std::cout << format("...") % x % y << std::endl;
>
> is parsed as
>
> std::cout << (format("...") % x % y) << std::endl;
>
> which makes it extremely simple to implement (only one "format" class
> is needed, as opposed to a bunch of strange classes that I couldn't
> even think of reasonable names for!). So I'm now firmly in favour
> of '%'.

That's a compelling argument.

> The main issue that concerns me is that the Unix-98 printf
> specification is just way too complex. For a start, I really don't

The printf() formats are also cryptic. Those are at once that format's
greatest strength and weakness. The format's cryptic nature makes it terse,
which is often seen as a virtue among C/C++ programmers, but that also makes
it difficult to spot mistakes. The complexity of the format means virtually
any required format is possible, yet it also makes it hard to learn and
remember.

> see the point in having to specify the type when the compiler knows
> it anyway (you mentioned something about literal '0' - how often
> would you really use this, and what's wrong with 0.0 anyway?). On

I quite agree.

> printf rules don't fit this pattern. Coming up with something better
> is not really "reinventing the wheel", its realising that horse &
> cart wheels aren't appropriate for modern cars :o)

That was, of course, the intent of the IOStreams machinery. In practice,
however, the loss of control, and the hard coded sequence of values inserted
into the output stream, make IOStreams insufficient for i18n. Thus, I quite
agree that we need something new. I'm not certain what it is yet, but we
can't design it in a vacuum. I have no experience with i18n, so my
knowledge of that arena is limited to what I've read in this thread and
elsewhere. Hence, I can't be sure that any of my ideas will be workable.
Nevertheless, I'm interested in contributing to the flow of ideas.

Rob
Susquehanna International Group, LLP
http://www.sig.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk