D interpreter

Lutger lutger.blijdestijn at gmail.com
Fri Oct 26 02:53:28 PDT 2007


Chad J wrote:
> Robert Fraser wrote:
>> Bruce Adams Wrote:
>>> Gregor Richards Wrote:
>>>> The CTFE interpreter is extremely limited (and slow).
>>> Maybe it should use a VM? :)
>>
>> That sounds like a lot of work & overhead for what basically ammounts 
>> to constant folding. Remember, CTFE is a compile-time optimization, 
>> not a way to execute the program.
>>
>> That said, CTFE with a GC and heap-allocation support would be nice, 
>> since my code uses a lot of objects.
> 
> CTFE is limited and problematic enough that it feels like some kind of 
> stop-gap measure to me.
> 
> I'd feel better if it was eventually going to be replaced by something 
> more elegant.  Something like the compiler compiling the CTFE code and 
> dynamic linking to it, then calling it as needed.  I know there are 
> security concerns about this, but just address them.  No ASM, no 
> external linking except for "safe" things like the stdlib, no pointer 
> manipulations that could access the compiler's memory space, etc.  But 
> jeeze, let us use arrays and classes.

You can use array, associative arrays and structs (literals). It's not 
'just' about constant folding, with the ability to manipulate strings 
and insert them as string mixins as code at compile time, you can do 
code generation. Don Clugston has made a compile time vectorizer which 
generates optimal assembly from vector expressions.

What you want looks like multi-stage programming (but restricted to 
compile time): http://www.cs.rice.edu/~taha/MSP/




More information about the Digitalmars-d mailing list