Boost logo

Boost :

Subject: Re: [boost] compile time parser generator
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2012-01-08 00:27:24


The Dave wrote:
>Actually, you gain expressivity but lose a lot of power when you do
>metaprogramming this way, as compared with TMP. With TMP you are
>working with first-class expressions so you can insert references to
>variables and other C++ entities right into your metaprogram. Also,
>different DSLs can be combined (e.g. as in Spirit and Phoenix) to do a
>more complicated job. That's really not so easy when you are working
>with strings.

Yes, I had already considered this. You would need to register C++ variables with the interpreter module to make them available to the interpreted code. It would be a pain in the neck, but could be encapsulated in a wrapper function. If the interpreter returns a function that is passable it becomes just as composable as any other function. That said, I don't think it's even remotely practical. The only reason to do it is because it is cool.

>The desire of "modern language theorists" is to enable language
>extension without losing interoperability with the rest of the language,
>and I think what you can do with constexpr, while very cool, still falls
>far short of that.

Yes, well, I guess I got a little carried away. This constexr based idea for a limited and painfully difficult to achieve mixed language application (which we have plenty of practical examples of) is indeed a far cry from implementing compiler optimizations as a library.

Regards,
Luke


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