From: "ktsj (Kazuki Tsujimoto)" Date: 2013-08-05T22:49:58+09:00 Subject: [ruby-core:56390] [ruby-trunk - Feature #8693] lambda invoked by yield acts as a proc with respect to return Issue #8693 has been updated by ktsj (Kazuki Tsujimoto). File lambda-yield.patch added I agree with the proposal, so I've attached a patch. With this patch: * yield invokes lambda as a lambda block * lambda block always checks the arguments But note that it may introduce incompatibility with JIS X 3017, ISO/IEC 30170. IPA Ruby Standardization WG Draft(http://www.ipa.go.jp/osc/english/ruby/ruby_draft_specification_agreement.html) specifies Kernel.lambda as follows. (Sorry, I don't have the official standard document.) > 15.3.1.2.6 Kernel.lambda > > Behavior: The method creates an instance of the class Proc as Proc.new does (see 15.2.17.3.1). > However, the way in which block is evaluated differs from the one described in 11.3.3 except > when block is called by a yield-expression. ---------------------------------------- Feature #8693: lambda invoked by yield acts as a proc with respect to return https://bugs.ruby-lang.org/issues/8693#change-40903 Author: rits (First Last) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: irb(main):004:0> def m1; yield end; def m2; m1 &->{return 0}; 1 end; m2 => 0 -- http://bugs.ruby-lang.org/