Software Assurance Reference Dataset

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 20 03:27:12 PDT 2014


20-Jul-2014 10:45, Walter Bright пишет:
> On 7/19/2014 11:06 PM, bearophile wrote:
>> A @tailrec annotation seems good, and will improve the functional
>> usages of D.
>> It should stop compilation with a error if the function doesn't call
>> itself or
>> if the compiler is not able to remove the recursive call. This means
>> it has to
>> be fully enforced.
>
> If you want to guarantee replacement of a recursive call with a loop,
> just write a loop.
>

Functional programming is full of simple recursion and it would be nice 
not to stack overflow in debug builds.

Another use case is so-called threaded code interpreter, that can be 
done with either computed gotos (and bunch of labels) or forced tail 
calls (and bunch of functions). In both cases computed jump or tail call 
is indirect.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list