Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Suggest changing default lambda notation to `->` for all lambdas #7566
For the reasons described here, I suggest changing the default setting for lambda notation to prefer, or at least tolerate, stabby lambda (
I've done a lot of thinking about this, and have worked with lambdas a lot. I think I have a pretty strong case supporting the use of stabby lambdas, and with the default setting currently prohibiting it for multiline lambdas, for every project I work on I have to bring up the subject of changing the config file, not a productive use of anyone's time, and especially not something a new team member would do without at least a little trepidation.
Describe the solution you'd like
Make the stabby lambda notation permitted, or ideally, preferred, for multiline lambdas.
I will paste the relevant content of the article here so it is colocated with this issue:
Stabby Notation as an Indicator of Preferred and Default Proc Type
In a previous article, "lambdas Are Better Than procs", I proposed that lambdas should be used rather than procs in almost all cases, given that they are safer in terms of argument count checking and return behavior.
So it makes sense that
One way to look at it is, by using the stabby lambda notation, we are
You're correct - this was the reasoning behind the current suggestion. I'm open to discussing this further, but keep in mind that's more of a topic for rubystyle.guide, as RuboCop simply follows the guidelines there.