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.