
Thorsten Ottosen wrote:
Jeff Garland wrote:
I've been working on a little project where I've had to doing lots of string processing, so I decided to put together a string type that wraps up boost.regex and boost.string_algo into a string type. I also remember a discussion in the LWG about whether the various string algorithms should be built in or not -- well consider this a test -- personally I find it easier built into the string than as standalone functions.
It might be slightly easier to use at first, but it goes directly
It doesn't stop being easier to use -- it's the same every day. Your implicit implication is that later on I'm going to find a bunch of extra functions that I can't perform with super_string. True enough. At that point I either add it to super_string or write it using the functional interface. No big deal.
against the spirit of low separation and minimal interfaces.
Against the spirit minimal interfaces for a single type, perhaps. Overall though, I'm radically simplifying the overall string processing interface 'surface area'. Compare the universe of all available boost string processing free functions in string_algo, format, lexical_cast, tokenizer, regex, and xpressive versus super_string. super_string is much smaller. And super_string can be documented without the 'noise' of all the template parameters associated with the lower level libraries. As for low separation, it's all template code, so you only pay for what you instantiate. If you don't use regex interfaces you don't need to link the library. Yes, there's more includes to process, but I think I can afford it. And again, I've lost nothing w.r.t using generic code -- I can still use it whenever I need.
Not a good idea IMO.
We disagree, obviously, and that's fine. Just to save some time, I'm pretty sure it's impossible to convince me that range or something else is going to solve my set of issues. I'll just point out, that some of this was a result of recent brushes of mine with other languages. I've been doing some coding lately in, gasp, Java and Javascript. As a diehard C++ developer, it ticks me off that I can sit down with the manual for these languages and in 15 minutes whip up some fancy string parsing code using regular expressions, etc. It's all very nice and neat. Go to the string reference page -- see the list of functions and boom, you're in business. So it gets me thinking, why is it that C++ makes this so hard? Well, std::string isn't as capable as Java's string. Of course, C++ (with Boost) has all of the same capabilities, but it takes a truckload of documentation and a masters degree to figure it all out. And then it's a pain in the neck to use and read the code. This is my attempt to rectify that. Jeff