From: eregontp@... Date: 2019-07-09T14:38:04+00:00 Subject: [ruby-core:93636] [Ruby master Feature#15973] Make it so Kernel#lambda always return a lambda Issue #15973 has been updated by Eregon (Benoit Daloze). alanwu (Alan Wu) wrote: > `Kernel#lambda` is in a weird spot. Even though it's a method, making it behave like one has the unfortunate side-effect of allowing proc transformation. Yes, the semantics of `Kernel#lambda` have always been a bit weird because no method should be allowed to convert a Proc to a lambda and inversely. And visually, `lambda { ... }` receives a block, which is a non-lambda Proc. My point of view is `lambda` is a relic of the past, and we should use `-> { ... }` instead, which has clear semantics and obviously you can't pass a pre-existing block to it. Yes, I think we should raise `lambda(&existing_block)` as that can't behave intuitively (it seems either useless or confusing). ---------------------------------------- Feature #15973: Make it so Kernel#lambda always return a lambda https://bugs.ruby-lang.org/issues/15973#change-79244 * 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: