DIP: Tail call optimization
Dietrich Daroch via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Sun Jul 10 10:10:32 PDT 2016
On Sunday, 10 July 2016 at 16:52:09 UTC, Ola Fosheim Grøstad
wrote:
> On Sunday, 10 July 2016 at 05:03:46 UTC, Dietrich Daroch wrote:
>> Hi everyone (=
>>
>> I've just added a new proposal to add a new attribute to
>> ensure TCO is applied.
>>
>> The proposal is really simple, but I'm clueless on how to
>> implement it and also interested on getting feedback on it.
>
> Why should it be part of the function prototype? @nogc makes
> sense, because it is a guarantee for the caller.
>
> @tco does not bring any guarantees to the caller, so you might
> as well annotate the call-site with some compiler specific
> feature.
Annotating every callsite seems uncomfortable, being able to
perform TCO is a property of the function and not something that
might look call-site dependant.
Ok, I see as why it can be useless for the caller, maybe this
should morph into a more general constant stack size growth
annotation, but I don't see uses other than enforcing TCO.
More information about the Digitalmars-d-announce
mailing list