A little of Partial Compilation

JAnderson ask at me.com
Wed Aug 20 08:16:55 PDT 2008


Walter Bright wrote:
> Don wrote:
>> Note that even if all parameters to a function are known at compile 
>> time, doesn't mean it's sensible to run it at compile time. (Example: 
>> calculating pi to fifty billion decimal places). The programmer needs 
>> to annotate it somehow to tell the compiler that is suitable for 
>> compile time.
> 
> It's one of those impossible problems for the compiler to predict if it 
> should attempt to execute a function at compile time or not. That's why 
> compile time function evaluation is initiated with a specific syntax, 
> rather than tried in general.

Perhaps that could be solved by automatic profiling.  The worst 
offenders could be put into a list and the compiler would spend longer 
on those functions to optimize them.  Also it would be something you 
could turn on and off with a compiler setting.

-Joel



More information about the Digitalmars-d mailing list