Compile time function execution...

Bill Baxter dnewsgroup at billbaxter.com
Thu Feb 15 16:30:50 PST 2007


Walter Bright wrote:
> Bill Baxter wrote:
>> Walter Bright wrote:
>>> ... is now in DMD 1.006. For example:
>>>
>>
>> Very nice!
>>
>> A few questions:
>> 1) You say recursion is allowed -- does it do proper tail recursion?
> 
> Tail recursion is a performance optimization, it has no effect on 
> semantics, so it's not an issue for compile time execution.

Yeh, it's not a big deal.  I was more just curious since you recently 
added it back to DMD.  And since it does affect the /effective/ 
semantics if you have a very deep recursion that overflows the stack. 
Or is the stack for compile-time execution is actually on the heap?

Either way, it might actually be /better/ to have the compile-time 
implementation have a limited stack so that infinite recursion errors 
result in stack overflows rather than just the compiler hanging.

--bb



More information about the Digitalmars-d mailing list