[swift-evolution] Proposal: Tail Call Optimization keyword/attribute

Per Melin p at greendale.se
Sat Dec 5 09:08:16 CST 2015


On Sat, Dec 5, 2015 at 2:55 PM, T.J. Usiyan <griotspeak at gmail.com> wrote:

>
> Tail call optimization can be a powerful tool when implementing certain
> types of algorithms. Unfortunately, ARC's semantics interfere with our
> ability to handle all possible cases of tail call recursion. An attribute,
> similar to Scala's `tailrec`, along with LLVM warnings, could allow a clear
> indicator of when such optimizations are not guaranteed to work.
>

I have primarily worked in functional languages with guaranteed tail call
elimination for many years. Turning to Swift, I (grudgingly) try to avoid
recursion altogether simply because of the risk of blowing the stack.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151205/b17900f6/attachment-0001.html>


More information about the swift-evolution mailing list