C++ Logo


Advanced search

Re: Please make string class more powerful

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sat, 5 Sep 2020 19:18:25 -0400
This is a nice sentiment (one that has been expressed by others). But
it's not a proposal; it's a complaint.

Complaints are important. They're where proposals *start*. But a
complaint alone isn't really a proposal. A proposal needs to explain
specifically what features need to exist (make std::string not be
"weak" isn't specific enough), justify why a class needs to exist that
provides these features, propose an API to accomplish these features,
and explain the various decisions that led to implementing them in
that way.

Even as a starting point for a discussion, "the string class in C++ is
way too weak" is not a good place to start. It's not specific enough;
it's an invitation for everyone to go over their personal bugbears
about `std::string`. There's no criteria for what would need to happen
to make it better, besides adding more stuff like Python and Java.

Lastly, nothing is said about the ability to do these kinds of things
right now. For example, C++20 gives us "split_view", which makes it
easy to split strings based on characters. Regex makes splitting
strings based on regular expressions doable, though not via a good
API. And case conversion is a non-starter in a programming environment
like C++ where Unicode just doesn't really exist yet.

Received on 2020-09-05 18:22:05