Compile time function execution...

BCS ao at pathlink.com
Thu Feb 15 13:07:07 PST 2007


Reply to Walter,

> BCS wrote:
> 
>> I think the issue is where compile time and runtime are both allowed,
>> but makes a *BIG* difference in performance.
>> 
> Right, which is why compile time execution is only done in contexts
> where it would otherwise error, such as in initialization of global
> constants.
> 


Hmm, so compile time evaluation is lazy, not greedy? That makes me want a 
cast(const) to force it in some cases


char[] CTwritef(...)

const char[] message = CTwritef(">>%s:%d foobar", __FILE__, __LINE__+1);
log(message);

vs.

log(cast(const)CTwritef(">>%s:%d foobar", __FILE__, __LINE__+1));

or best of all, why no have it greedy?

log(CTwritef(">>%s:%d foobar", __FILE__, __LINE__+1));





More information about the Digitalmars-d mailing list