From: Joel VanderWerf Date: 2013-03-27T03:19:02+09:00 Subject: Re: Need help on Kernel#eval On 03/25/2013 11:33 PM, Love U Ruby wrote: > From the link -> http://www.ruby-doc.org/core-2.0/Binding.html > > Objects of class Binding encapsulate the execution context at some > particular place in the code and retain this context for future use. The > variables, ***methods, value of self, and possibly an iterator block > that can be accessed in this context are all retained***. Binding > objects can be created using Kernel#binding, and **are made available to > the callback of Kernel#set_trace_func**. Here's an example of getting the iterator block from the binding, but there is something puzzling: def foo; binding; end bi = foo {|x| p(x+1)} bi.eval "yield 2" # ==> 3 eval "yield 2", binding # ==> LocalJumpError The puzzle is: why does Binding#eval call the block, but Kernel#eval does not? Anyone...?