Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-07-09 12:50:51


Martin Wille wrote:
> Joel de Guzman wrote:
>> Martin Wille wrote:

Catching up on a few things.

> String handling is the thing Java got basically right, IMHO. Java
> distinguishes between a string class (immutable strings) and a string
> builder class. Typically, immutable string classes are memory efficient
> because they allow for sharing instances easily and time efficient
> because they allows for easy passing of the strings into and out of
> functions. String builders focus on modifying contents and intend to
> save memory and execution time and to avoid memory fragmentation by
>...
>
> The proposed super string could be a nice string _builder_, while the
> proposed functional/view interface could operate nicely on an immutable
> string class, std::string and on the string builder.

I mostly agree with your points, except that it lives in denial of the
existence and experience of programmers with basic_string. As much as we have
issues with the approach it's there and it's used heavily. I need to
inter-operate with it. My approach is to build some additional capabilities
onto it. Clearly that's not going to please everyone, but I think it's a
reasonable approach.

>....
> Use-cases in favor of either approach can be made. Consequently, there's
> room for both suggested ways of dealing with character sequences and for
> the libraries supporting them. What we need in order to avoid confusion
> is to communicate clearly what the intent of the classes or
> views/functions is. So if we add the suggested super string then PLEASE
> do not name it 'string', but 'string_builder' or 'string_buffer' in
> order to emphasize on the in-place modification aspect in the name. Of
> course, there should be a complement to string_builder:
> immutable_string. (ISTR there was a proposal for that, already).

I'm not going to change the name because I'm not planning on changing the
approach. It's a derivative of basic_string -- that makes it a string. In
the next version there will be an experimental const_super_string which is an
immutable version built on the proposed boost::const_string.

My goal is to extend the standard library in a useful way, not pitch it out
and rewrite it completely.

Jeff


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