Andrew Godfrey:

1) A function annotation that means "I will call myself
recursively, and when I do, I expect the tail recursion
optimization." I have seen code which allocates something big on the stack and depends on the optimization. So this intent should
be expressible.

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.

Perhaps a @cps (or @continuation) annotation is better and more general.

Bye,
bearophile

Reply via email to