Don:

>CTFE is almost completely isolated from the rest of the compiler: it can't 
>break anything that's  not CTFE.<

It's like having a compiler plus a D1 interpreter. In theory this duplication 
looks silly, in practice it seems handy.


>It is likely, for example, that unions will need to be disallowed in CTFE,<

Can you tell me why?


>but there's absolutely no reason why 'new' expressions should be disallowed.<

There's a compiler for a small language (designed for embedded CPUs) that 
allows to allocate objects at compile time (it also compacts their fields in 
smart ways, grouping fields of similar type from more than one object in a 
transversal way into arrays of single fields, and compacting pointers reducing 
their size, to save memory and speed up programs a little), and then at runtime 
the memory can't be allocated dynamically. D can do something similar, 
allocating such compile-time objects. It may save running time. I'd like to 
know what people think about this.

Bye,
bearophile

Reply via email to