From: Jeff Garland (jeff_at_[hidden])
Date: 2006-07-06 02:34:35
David Abrahams wrote:
> Jeff Garland <jeff_at_[hidden]> writes:
>> I guess I have yet to be convinced of the supposed disadvantages.
>> super_string is just as extensible as basic_string.
> Only sort of. Noninvasive extensions are relegated to "second class"
I stand by my original statement: 'super_string is just as extensible as
basic_string'. Your comment applies to basic_string as much as super_string.
Although I guess there's really nothing stopping someone from deriving from
super_string and adding their own nifty functions -- as long as they're stateless.
Still, I don't see how the current alternative of having "second class" syntax
for all advanced string code is better? And C++ programmers have to deal with
the fact that some code may be written in an 'object style' and some in a pure
functional style -- that's just life as a C++ programmer.
>> No, I got it, but I don't know what to do with it. Python chose to leave it
>> out of the string class -- Java chose to provide a simplified interface(just
>> to be clear, there's a Pattern class in JAVA that works with
> Python also has a pattern class that works with string.
> python -c "import re; help(re.compile(''))"
> What point are you making here?
I'm just clarifying that in Java all the 'Regex functionality' isn't all
embedded in the String class -- but there is a relation between the two.
super_string is very similar to the JavaString in that respect.
>> In Perl it's helped along by language features, but it's essentially
>> built-in using operators.
> Most operators in C++ can be implemented as free functions.
I realize -- and perhaps something could be done to emulate a perl-like
syntax. But I think there's plenty of people that would be against that idea
as enabling even more obscure code -- me among them. I'm open to being
convinced, but I think clear function names will end up being superior.
>> Overall though, I didn't see the motivation for leaving Regex out if
>> I'm going to add other functions to the string type.
> Well, you have to stop somewhere. Regex might be a good place because
> it represents a rather large, complicated, and rather different batch
> of functionality from the rest of what one gets from string. And it
> draws in dependencies that not everyone needs.
>> There's no user cost if they don't use Regex other then processing
>> of a few extra includes on compile.
> Linking with more libraries, perhaps?
Nope. basic_superstring is a template, so if you never call a *_regex
function you won't need to link in the regex library -- it's a header only
dependency. If this weren't the case, I'd agree with you.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk