Project

General

Profile

Feature #15973

Let Kernel#lambda always return a lambda

Added by alanwu (Alan Wu) over 1 year ago. Updated 30 days ago.

Status:
Closed
Priority:
Normal
Target version:
[ruby-core:93482]

Description

When Kernel#lambda receives a Proc that is not a lambda,
it returns it without modification. l propose to change Kernel#lambda
so it always returns a lambda.

Calling a method called lambda and having it do nothing in effect is
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]


Related issues

Related to Ruby master - Feature #12957: A more OO way to create lambda ProcsFeedbackActions
Related to Ruby master - Feature #7314: Convert Proc to Lambda doesn't work in MRIAssignedmatz (Yukihiro Matsumoto)Actions
Related to Ruby master - Feature #9777: Feature Proposal: Proc#to_lambdaFeedbackActions
Related to Ruby master - Feature #8693: lambda invoked by yield acts as a proc with respect to returnClosedktsj (Kazuki Tsujimoto)07/26/2013Actions
Related to Ruby master - Bug #16004: Kernel#lambda captured with Kernel#method doesn't create lambdasClosedActions
Related to Ruby master - Bug #15620: Block argument usage affects lambda semanticClosedko1 (Koichi Sasada)Actions
Related to Ruby master - Feature #16499: define_method(non_lambda) should not change the semantics of the given ProcRejectedActions

Also available in: Atom PDF