CTFE Status

Meta via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 2 13:52:05 PST 2017


On Monday, 2 January 2017 at 19:01:43 UTC, Stefan Koch wrote:
> On Monday, 2 January 2017 at 18:40:44 UTC, Stefan Koch wrote:
>> So guys.
>>
>> basic function-calls are supported.
>>
>> Hell YEAH!
>
> Meaning this will compile :
>
> uint caller(uint n)
> {
>   return callee(n, 2);
> }
>
> uint callee(uint a, uint b)
> {
>   return a*b;
> }
>
> static assert(caller(3) == 6);
> static assert(caller(24) == 48);
>
>
> uint rfn(uint n)
> {
>   if (n) return n + rfn(n-1);
>   return 1;
> }
>
> pragma(msg, rfn(2000));

There's something I've been wondering about. NewCTFE is basically 
just another backend, right? Does this mean that you'll have to 
implement various optimizations such as tail-call elision 
independently from what DMD with the default backend currently 
does?


More information about the Digitalmars-d mailing list