Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2004-09-04 18:31:16


Jonathan Turkanis wrote:
> "Eric Niebler" <eric_at_[hidden]>
>><< xpressive 0.9 >>
>>
>>http://boost-sandbox.sourceforge.net/libs/xpressive
>>
>
> Looks great!

Thanks!

>
> A few questions. (Please forgive me if they are answered in the docs, I haven't
> finished reading them):
>
> - Have you considered allowing format strings to be bound statically?

That hadn't occured to me. Certainly possible, but I think the returns
would be small. The complexity of doing string replacements is linear,
and so is not as sensitive to optimization as pattern matching. And the
format string has very simple syntax, so static syntax checking isn't as
big of a win here, either.

> - Have you considered using _1, _2, _3 instead of s1, ... for capturing
> paretheses? You could also use them as placeholders in statically-bound format
> strings.

Yes, I used _1, _2, _3 for a long time. I abandoned it because of name
conflicts with the identically-named placeholders from other boost
libraries. I picked s1, s2, ... for two reasons:
1) The "s" in "s1" stands for "sub-match", which is what these thigs
represent.
2) s1 kind of looks like $1, which is the perl equivalent.

That said, I'm open to suggestions for avoiding the name conflicts. I
would consider switching back to _1 _2 _3 if the technical problems were
overcome and if people liked it better.

> - have you considered overloading operator/ to emulate perl syntax for
> substitution. E.g.,
>
> s/expr/fmt,
> sub/expr/fmt, or just
> expr/fmt
>
> could return a function object with templated operator which invokes
> regex_replace.
>

A little too cute, IMO.

> Just some thoughts ....

Keep 'em coming.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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