
On Thu, Sep 3, 2009 at 3:45 AM, Richard Webb<richard.webb@boldonjames.com> 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: http://lists.puremagic.com/pipermail/digitalmars-d-announce/2009-August/0139...
<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).