Skip to content

Make Kernel#lambda always return a lambda - #2262

Closed
XrXr wants to merge 1 commit into
ruby:masterfrom
XrXr:consistent-lambda
Closed

Make Kernel#lambda always return a lambda#2262
XrXr wants to merge 1 commit into
ruby:masterfrom
XrXr:consistent-lambda

Conversation

@XrXr

@XrXr XrXr commented Jul 2, 2019

Copy link
Copy Markdown
Member

Before this commit, when Kernel#lambda receives a Proc that is not a lambda,
it retuned it without modification. This commit makes it so that in all
cases, Kernel#lambda returns a Proc that is a lambda.

Calling a method called lambda and having it effectively do nothing was
not very intuitive.

Feature #15973
Bug #15620

@XrXr

XrXr commented Jul 2, 2019

Copy link
Copy Markdown
Member Author

This does two allocations when the input is a subclass of Proc. I did it this way because the code looks clearer to me this way. Let me know if you prefer eliding the allocation instead.

@XrXr
XrXr force-pushed the consistent-lambda branch 2 times, most recently from 5f4d777 to 052acaf Compare July 2, 2019 13:25
Before this commit, when Kernel#lambda receives a Proc that is not a lambda,
it retuned it without modification. This commit makes it so that in all
cases, Kernel#lambda returns a Proc that is a lambda.

Calling a method called lambda and having it effectively do nothing was
not very intuitive.
@XrXr
XrXr force-pushed the consistent-lambda branch from 052acaf to c03e55c Compare July 8, 2019 00:48
@k0kubun

k0kubun commented Aug 17, 2019

Copy link
Copy Markdown
Member

It seems to have a conflict now. Could you rebase this from master?

@XrXr

XrXr commented Aug 17, 2019

Copy link
Copy Markdown
Member Author

Thanks for the ping. Judging from the discussion about this proposal, I don't think this is going in. I'm also not sure if this is a good idea any more. I will close this for now and rebase this if the proposal gets accepted.

@XrXr XrXr closed this Aug 17, 2019
@XrXr
XrXr deleted the consistent-lambda branch July 9, 2020 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants