A Tale of TwoTails – Mutual tail recursion in Scala

TwoTails is a compiler plugin written to add support to Scala for mutual tail recursion. While Trampolines or trampolined style recursion solve the direct need, they require explicit construction by a developer and add overhead in the form of additional data structures. Unfortunately, building a “native” solution directly into Scalac without using trampolines is not a straightforward task, even with basic tail recursion. In the latest version, a second compilation scheme has been introduced solving an issue peculiar to the JVM which the first scheme was not able to properly address. I’ll discuss both the motivation behind this new scheme and the trade-offs entailed by using it, highlighting which is more appropriate given your circumstances.

* Material *

Slides

* Event *

Typelevel Summit New York City, March 2017

* About Speaker *

Owein is the Director of Creatives Engineering at MediaMath. His teams have built systems in Scala which handle over 1M req/s with under 10ms latency daily. Originally starting out as a mathematical programmer working in infrared countermeasures, he moved on to become a full fledged software developer involved first with NASA satellite systems and then with hedge fund analytics. Since discovering the joys of functional programming, he’s looked for ways to incorporate higher powered abstractions in all the code he writes, when he gets to write code.

* Licensing *

This recording is licensed under CC-BY 4.0 (https://creativecommons.org/licenses/..).

0 Comments.

Leave a Reply

Your email address will not be published. Required fields are marked *