
Jeff Garland <jeff@crystalclearsoftware.com> writes:
David Abrahams wrote:
Jeff Garland <jeff@crystalclearsoftware.com> writes:
David Abrahams wrote:
Jeff Garland <jeff@crystalclearsoftware.com> writes:
The fact is, if you look around at the languages people are using most for string processing, they offer just as many features as super_string and then some. Try "python -c help(str)" Looks like I'm still missing a couple functions ;-)
And by the same measure, you have some extras (no regexps in python strings).
True, but for my work I need regex
I'm not saying regex isn't important.
and I've cited other languages where it is integrated.
Yes. There are examples of both.
Well, Shunsuke Sogame's proposed interface (which echoes some work Eric Niebler has already done) works pretty well. I don't think that concatenating string operations with '.' is vastly better than using '|', and the former comes with some attendant disadvantages that have been detailed elsewhere in this thread.
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" syntax.
I can still take advantage of Sunsuke's code. But, I think there was actually some agreement that if we surveyed programmers more would understand form #1 without reading the docs then #2.
1) s.replace_all(s2, s3) 2) replace_all(out(s1), in(s2), in(s3));
Sure.
Java, Javascript, and Ruby that build regex directly into the library/language. Whoa there. Python builds regex directly into the library too. That doesn't mean it should be part of the string.
python -c "import sre;help(sre)"
I wasn't trying to suggest that Python didn't support regex.
Didn't think you were; you seem to be missing my point, which is that there are lots of ways to get the functionality into the library. It doesn't necessarily have to be directly attached to the string class.
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 string).
Python also has a pattern class that works with string. python -c "import re; help(re.compile(''))" What point are you making here?
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.
So it's a mixed bag as far as how people have chosen to build these functions.
Exactly.
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? -- Dave Abrahams Boost Consulting www.boost-consulting.com