Tobias Müller:

Wouldn't it be more useful to have a modified/annotated return statement for that?

I don't know.


Tail-recursiveness is an implementation detail, for the user of the function it's not really interesting.

Yes, in theory a @tailrec annotation doesn't change the mangling of the function. But D has exceptions and stack traces. A stack trace for an annotated function is different because there are less stack frames...


Except for the fact that it has bounded stack size which is a useful property by itself and not only for tailrecursive functions.

Yes, that's why I have said that a @continuation is a more general solution than @tailrec.

Bye,
bearophile

Reply via email to