From: "rits (First Last)" <redmine@...> Date: 2013-08-02T06:14:46+09:00 Subject: [ruby-core:56312] [ruby-trunk - Bug #8693] lambda invoked by yield acts as a proc with respect to return Issue #8693 has been updated by rits (First Last). alexeymuranov (Alexey Muranov) wrote: > =begin > This looks strange to me too. Also this: > > def y; yield end > L = lambda{return 0} > > def f; y &lambda{return 0} end > def g; y &L end > > f # => 0 > g # LocalJumpError: unexpected return > =end That a return in a lambda invoked by yield attempts to return from the method enclosing the lambda definition, has already been demonstrated. The LocalJumpError is just a consequence of that, L is not defined in a method, so the attempted return fails. I don't think your example reveals anything new, does it? ---------------------------------------- Bug #8693: lambda invoked by yield acts as a proc with respect to return https://bugs.ruby-lang.org/issues/8693#change-40806 Author: rits (First Last) Status: Rejected Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.0.0p247 (2013-06-27) [x64-mingw32] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN irb(main):004:0> def m1; yield end; def m2; m1 &->{return 0}; 1 end; m2 => 0 -- http://bugs.ruby-lang.org/