DIP: Tail call optimization
Andrew Godfrey via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Mon Jul 11 07:36:22 PDT 2016
On Monday, 11 July 2016 at 10:25:36 UTC, Tofu Ninja wrote:
> On Sunday, 10 July 2016 at 13:15:38 UTC, Andrew Godfrey wrote:
>> Btw here's a thread from 2014 that touches on the idea of a
>> "tailrec" annotation. At the time, Walter viewed the
>> optimization as the compiler's business and not something he'd
>> elevate to a language feature:
>>
>>
>> http://forum.dlang.org/post/lqp6pu$1kkv$1@digitalmars.com
>
> I find it odd that something like tail recursions that actually
> makes certain things possible that wouldn't be otherwise is
> seen as only an optimization, when things like inlining which
> really is only an optimization is seen as important enough to
> have a pragma.
I agree. Maybe Walter has reconsidered since then. He did also
say, though, that he thinks D supports enough different
programming styles already.
Would you be satisfied with a pragma? I'd intuited (but could be
wrong) that the focus of your proposal was to get a compiler
error if someone makes a change to a recursive function, that
causes the compiler to be unable to apply the TCO optimization.
If that is your focus, it has heavy implications and the feature
can't just be a pragma.
More information about the Digitalmars-d-announce
mailing list