RubyHACK 2018: Ruby Unblocked by Eliza De Jager
Channel: Confreaks
Date: 2018-07-05

RubyHACK 2018: Ruby Unblocked by Eliza De Jager

Ever noticed how flexible the use of blocks can make Ruby code? They allow us to reuse code easily, and to dynamically define not only method names but also method bodies, thereby essentially making metaprogramming possible. In this talk we properly define blocks as closures. We discuss scope gates and how blocks manage to get around them, and how lambdas take this even further by allowing us to use variables defined in a different scope from where the lambda is executed inside the lambda body. We also take a look at what goes on in the Ruby stack and heap which makes all of this possible.