Compile time function execution...

Reiner Pope xxxx at xxx.xxx
Thu Feb 15 20:59:10 PST 2007


Walter Bright wrote:
> Michiel wrote:
>> * the syntax for functions to be executed at compile time isn't the
>> nice-and-simple D syntax, but the template-syntax. And in another thread
>> you yourself have mentioned why that's not optimal. I agree.
> 
> I don't think eval!(expression) is an undue burden. It's hard to imagine 
> how any other syntax would look better.
But in many situations, you could view compile-time function execution 
simply as a high-level optimization, an extension on 'inline'. Why, 
then, does it make sense to require explicit eval!() annotations, when 
it clearly doesn't make sense to do this for inline?

Viewing this as a more complex extension to inlining, I think the 
correct approach is to allow explicit annotations for 'only at runtime' 
and 'only at compile time' and have the rest decided according to a 
compiler switch, eg -pre-eval

Cheers,

Reiner



More information about the Digitalmars-d mailing list