Boost logo

Boost :

Subject: Re: [boost] optional<optional<T>>
From: Tor Brede Vekterli (vekterli_at_[hidden])
Date: 2009-09-03 10:30:48

On Thu, Sep 3, 2009 at 12:59 PM, OvermindDL1<overminddl1_at_[hidden]> wrote:
> On Thu, Sep 3, 2009 at 3:45 AM, Richard
> Webb<richard.webb_at_[hidden]> wrote:
>> OvermindDL1 wrote:
>>> Slightly off-topic, but I consider D to be a *fascinating* language,
>>> kind of like how C++ should have been.  It would actually be *much*
>>> easier to create Spirit in D then it would have been in C++, and you
>>> could have used real PEG syntax instead of C++/D'ifying it.
>> I've been looking at D a bit myself recently, and i just saw this on the D
>> mailing list:
> <still off-topic>
> Heh, interesting, but they are going about it the completely wrong
> way.  First Spirit 1's design is quite a bit more convoluted then
> Spirit2's.
> Second, thanks to mixin's and the fact that templates can operate on
> strings in D (not just integers and types like in C++), they could
> implement a *real* PEG syntax that gets completely lowered to pure D
> code at compile-time.
> Yes, D is that powerful.  Heck, if C++ added D style templates and
> mixin support and compile-time functions (which I guess is kind of
> getting added to C++1x), I would be happier then you could believe.
> :)
> For an example, I even saw a pure compile-time regex parser that you use like:
> static_regex!("gh.+a") r;
> regex_info info = r(someString);
> In D a template is !() unlike in C++ where it is <>.  I personally
> like <> better since I am used to it, but !() is certainly easier to
> parse and is unambiguous...
> But yes, that regex is completely lowered to pure D code at compile
> time, ala Boost.Xpressive's static regex parser.
> D really does mix in a lot of LISP's power into a C++ syntax (not all
> of LISP's power, but it gets *REALLY* close).
> _______________________________________________
> Unsubscribe & other changes:

(further continuing the off-topic trail here)

For what it's worth, I've written a proof-of-concept compile-time
recursive descent string parser in pure C++:

It even comes with a static regex string to Xpressive transformation
grammar (through a layer of indirection) :) although it's currently
limited to MPL strings, so the syntax isn't as pretty as it could be
with C++1x user-defined literals. Just shows that it is possible to do
even with "vanilla" C++.

Best regards,
Tor Brede Vekterli

Boost list run by bdawes at, gregod at, cpdaniel at, john at