From: XrXr@... Date: 2019-07-12T04:11:19+00:00 Subject: [ruby-core:93708] [Ruby master Feature#15973] Make it so Kernel#lambda always return a lambda Issue #15973 has been updated by alanwu (Alan Wu). The idea to generate a delegating lambda seems to side-step a lot of the issues posted here. For reference here are some quotes from the log in #15930: ```ruby b = proc {|x| x } lambda(&b) #=> lambda {|x| b[x] } b = proc {|x, y, k:1| x } lambda(&b) #=> lambda {|x, y, k:1| b[x, y, k:k] } ``` This preserves the `return` semantics in the original proc. I would imagine it would also add an entry to the call stack. (side note, I think the default parameter evaluation has to be left to the original proc too since a `return` could be in there) What do you folks think about this? ---------------------------------------- Feature #15973: Make it so Kernel#lambda always return a lambda https://bugs.ruby-lang.org/issues/15973#change-79336 * Author: alanwu (Alan Wu) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- When Kernel#lambda receives a Proc that is not a lambda, it returns it without modification. l propose changing `Kernel#lambda` so it always returns a lambda. Calling a method called lambda and having it effective do nothing was not very intuitive. https://github.com/ruby/ruby/pull/2262 Judging from marcandre's investigation here: https://bugs.ruby-lang.org/issues/15620#note-1 changing the behavior should not cause much breakage, if any. This also happens to fix [Bug #15620] -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>