Boost logo

Proto :

Subject: Re: [proto] Other methods for embedding DSL in C++
From: Manjunath Kudlur (keveman_at_[hidden])
Date: 2010-07-26 16:14:38


> I confess I'm having a hard time seeing how the code posted in
> Manjunath's original email could result in something that can be
> introspected at runtime. Does it generate byte code? A runtime
> polymorphic AST? And the JIT ... does it actually generate machine code
> that then gets executed?

At the end of the END block, you would have an AST. Yes, there will be
a JIT and an associated run time to compile this and run on different
platforms.

>>> P.S : Someone more familiar with Rapidmind or other variants, can you
>>> please explain how they do it in more detail?
>>>
>> Rapidmind is one huge vaporware. Nobody ever saw it running ...
>
> Manjunath asked about why this technique is popular in industry. I don't
> know; I've never heard about it before. Is it because it's easier then
> programming with expression templates? Maybe had proto been available

You wouldn't believe how many of my otherwise expert C++ programmer
friends get a disgusted look on their face when they see templates. I
couldn't figure out why :(
That being said, I see one obvious advantage with proto. With proto,
when you write an expression like
if_(a > b) [c = d + 2.0*a].else_[c = d-2.0*a]
you can just "natively" execute it. But with RT-DSLs, you have to
generate an AST by running the code, then JIT and only then you can
execute it. If you wanted a system where you can just natively
"interpret" you program, or generate code for different platforms,
then proto makes the interpreter very fast. Whereas with RT-DSLs, even
interpreting has to be differed to run time.

Manjunath


Proto list run by eric at boostpro.com