[ruby-core:93682] [Ruby master Feature#15973] Make it so Kernel#lambda always return a lambda
From:
ruby-core@...
Date:
2019-07-11 11:57:51 UTC
List:
ruby-core #93682
Issue #15973 has been updated by marcandre (Marc-Andre Lafortune).
knu (Akinori MUSHA) wrote:
> I don't think the lambda flag should be altered after the creation of a proc, because it's all up to the writer of a block how `return`/`break` etc. in it should work.
>
> What about just deprecate `lambda` in the long run in favor of the lambda literal `->() {}`?
akr wrote similar opinion.
This same opinion would call for deprecation of `define_method(&block)`, which I believe would be a mistake.
I am assuming it is clear that `lambda(&block)` would never mutate `block` and return a new object that would be a lambda.
----------------------------------------
Feature #15973: Make it so Kernel#lambda always return a lambda
https://bugs.ruby-lang.org/issues/15973#change-79296
* 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>