Boost logo

Boost :

Subject: Re: [boost] [RFC] string inserter/extractor "q u o t i n g"
From: Daniel James (dnljms_at_[hidden])
Date: 2010-06-23 14:51:23


On 23 June 2010 16:01, Eric Niebler <eric_at_[hidden]> wrote:
> On 6/23/2010 6:12 AM, Daniel James wrote:
>>
>> You should inherit from std::runtime_error, since that would be
>> usually caused by bad input rather than programmer error.
>
> Bad input can be a programmer error too.

I meant input from an external source. Which would almost always be
the case for this function. Any such function must be able to cope
with any possible string.

>> To be honest, I don't see the value of this. As this is the kind of
>> thing which is handled well in other ways (e.g. using a parser or
>> lexer generator, or a standard data format such as XML, JSON etc.).
>> There tends to be odd differences in quoting, encoding and escaping
>> styles making a generic function awkward. It's not as specific as a
>> filename extractor and not as generic as a parser and it's not clear
>> why there's a need for something in between.
>
> Parser and lexer generators are complicated beasts, and I wouldn't send
> a novice programmer in that direction if it could be helped.

"...or a standard data format such as XML, JSON etc."

> Most
> quoting/unquoting is very straightforward. There's a quote character and
> an escape character. For anything more complicated, yes, build your own.

I don't think it's ever been that simple in my experience.

Daniel


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