|
Boost : |
Subject: Re: [boost] Variadic append for std::string
From: Olaf van der Spek (ml_at_[hidden])
Date: 2017-01-11 03:31:53
On Wed, Jan 4, 2017 at 11:28 AM, Hans Dembinski <hans.dembinski_at_[hidden]>
wrote:
> Hi Olaf,
>
> >> I think << is quite elegant.
> >
> > I feel very uneasy with it and I think I have presented quite some
> > reasoning why. Also I don't seem to be the only one in this discussion.
> > At least that should count as a strong indicator, that you need much
> > better reasons to back your proposal.
>
> I agree with Christof. Also think about consistency within the C++
> standard library. Consistency is good, because it allows you to apply the
> same thinking elsewhere, instead of looking up everything in a reference.
> There should be a minimum of surprises in using a language and a library.
> Python does this very well, it is codified in the "There should be one -
> and preferably only one - obvious way to do it" rule.
>
> Since many years we have established streams and containers as separate
> things. std::string is a container, std::ostringstream is a stream. They
> have separate responsibilities. You should not mix these. Herb Sutter and
> other experts already use std::string as a prime example of a class with
> too many responsibilities (in form of many member functions). Like it was
> said before, std::string should be a dynamic container of characters,
> nothing more.
>
I agree with Herb and that's why those operators are NOT member functions..
Note that the proposed syntax could also support other containers.
-- Olaf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk