Boost logo

Boost :

From: Samuel Krempp (krempp_at_[hidden])
Date: 2001-12-20 16:49:13


On Thu, 2001-12-20 at 22:20, Karl Nelson wrote:

> This is much more clear in my mind than
>
> cout << format("%1 %2") % 1 % 2 << endl;
>
> Which mixes one stream concept with another. Mixed notation like that

No. on one side, the stream, and its <<.

On the other side, the format object, getting its argument via
successive calls to operator%.

the operator% here is just a way to get arbitrary number of arguments,
nothing more.

It's a concept that has nothing to do with streams, or formatting, or
whatever. It's more general, and a much simpler concept than streams.

BTW, I guess there will sooner or later be other libraries who'll need
the same kind of mechanism for passing arbitrary number of arguments.
Why would we not begin using operator% now to express this concept ?
(or another operator, you name it, I use it..)

> Which mixes one stream concept with another. Mixed notation like that
> is just plain unpleasant to read and introduces another operator which
> "acts like" a stream put operator. I made mine a manipulator the
> first time just because I did not want to introduce extra concepts
> beyond what the C++ programmer knows and operator "%" meaning stream is

huh ? either you pass variables via an operator, either by the classical
arguments passing of functions.
What extra concepts unknown to some C++ coders could have replaced using
an operator here ?

Didn't you decide to use an operator simply because you don't know at
compile-time how many variables you'll be needing, and operators are the
only (full) way around that ?
(I did.)

In your point of view, I'm using % to implement a 'stream concept'.

From my point of view, you're using operator<< to express the concept of
'passing arbitrary number of arguments'. It's not stream concept here.
it's just arguments. You should not pretend it's a stream.
<add rants about mixing notations here>

regards,

-- 
Samuel

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