Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Muggle's Guide to Tail Call Optimization in Ruby

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

A Muggle's Guide to Tail Call Optimization in Ruby

Submitted for your approval: a circle of torment unchronicled by the poets of old, a terror at the heart of many a horror story: SystemStackError: stack level too deep

Tremble no more! Conquer the well of eternity!

Behold the secrets of tail recursion and tail call optimization in Ruby! Witness the metamorphosis of a simple function as we explore the hidden power of tail call optimization buried deep within the Ruby VM! Follow the transformation to the revelation of tail call optimization's most ghastly secret: in many ways it's really just a special type of loop construct! The horror!

Animated slides: http://a-muggles-guide-to-tail-call-optimization-in-ruby.tdg5.com
Source code: https://github.com/tdg5/a-muggles-guide-to-tail-call-optimization-in-ruby

About:
Danny Guinther is a senior software engineer at Datto in Boston where he leads the platform team against the ever looming threat of technical debt and decay. With more than 5 years of experience with Ruby, Rails, and related technologies, Danny possesses an enthusiasm for the web and open source software. A self-proclaimed Ruby champion and developer advocate, when Danny's not coding, he can be found scheming of ways he could be coding or trying to convince himself that "hobbies" are a good idea.

Avatar for Danny Guinther

Danny Guinther

November 16, 2015
Tweet

More Decks by Danny Guinther

Other Decks in Technology

Transcript