January 2009
1 post
Ruby Doesn't Have Inner Functions
Ruby syntax allows you to write something that looks a lot like an inner function in other languages. However, it really isn’t. Lets explore this odd behavior. class Foo def bar x = "scoped variable" def baz puts x end end end This looks like a pretty standard test of closures. One might expect the bar method to define a function baz with access to bar’s...
Jan 17th