Software Assurance Reference Dataset
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jul 21 15:10:05 PDT 2014
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
More information about the Digitalmars-d
mailing list