It seems pure ain't so pure after all

foobar foo at bar.com
Tue Oct 2 00:23:51 PDT 2012


On Monday, 1 October 2012 at 22:47:48 UTC, Timon Gehr wrote:

>
> A D compiler is also a D interpreter. I wouldn't even bother 
> with D if this wasn't the case.

A D compiler _contains_ a limited interpreter for constant 
expression evaluation. This has limitations such as not being 
able to perform IO at compile-time (there's a special pragma for 
that). This is merely an outgrowth of a compiler optimization 
technique.

Now, back on topic:
I agree with Jonathan - in general the compiler can't evaluate 
_all_ functions at-compile time due these limitations of CTFE and 
adding a compiler flag will make compilation times far worse than 
c++. Adding a function attribute adds marginal benefit over 
simply assigning to a static/enum variable.


More information about the Digitalmars-d mailing list