-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefer reduce
over inject
#237
Conversation
👍 |
I don't have an opinion one way or the other. I guess this makes sense, though, just for the symmetry (and crossover from JavaScript). I've always thought |
👍 |
By "gain popularity", can I see the prove? Maybe only haskeller who also writing Ruby?
I use I don't understand why this change has to be in place. It feels bikeshedding to me. If people prefer to use I'm voting for removing this rule, and use whatever you want that floats your boat. |
Also, quote @pbrisbin from the previous PR:
I think that still applies to this change. I don't see a need for this change either. |
Perhaps we should remove our preference altogether? |
We had a very similar discussion in #169. The end result was that, in general, people preferred
Although I don't think it matters much which name we use, I prefer to have consistency. Is there any benefit to using different names in different places? |
As usual, it seems I agree with past @mike-burns
|
We can't. Because there's this guideline. It is a form of bikeshedding. But this is the repository for bikeshedding.
I can't think of a single stylistic change that would be worth this. If that's the bar we might as well freeze all modifications to style, right? Is that really the bar?
I don't think that is... or should be, anyway... the point of our guides. Strong opinions, loosely held and all. We should always be open to re-examining past decisions. If starting a new project today, I would prefer to use I think this is a pretty minor change. If people prefer |
In some cases, we're creating a new guideline where there wasn't one before. The bar is easier here, because it's not creating inconsistency, as the old code was already inconsistent. When reversing an earlier decision, I think the bar has to be higher. It's still fuzzy, but I think we have to decide as a group that we dislike the current guideline more than we'd dislike having (hopefully temporary) inconsistency during the transition. A recent example was the transition to RSpec's new default syntax, using In this case, I don't personally have strong feelings about |
We've put things to votes before. Could that be incorporated into the process of deciding on things like that? |
https://github.com/bbatsov/ruby-style-guide#map-fine-select-reduce-size In this case, I doubt the transition from I agree with Derek about "strong opinions, loosely held" but also don't On Mon, Oct 20, 2014 at 8:58 AM, Greg Lazarev [email protected]
|
I created a poll so that we can see where things currently stand: https://docs.google.com/a/thoughtbot.com/forms/d/1XFIOLZju440wUiVLPd2jIz2iRlFYg2vCm9-l9lFLZc8/viewform?usp=send_form |
Latest results: 7-2 is a pretty strong consensus, so I guess we'll make the switch. @derekprior feel free to merge. |
`reduce` provides symmetry with our already-preferred `map`. Additionally, it has a more intention-revealing name and is more approachable for people unfamiliar with it. "I am reducing this array to something". `inject` doesn't make the same sense.
2d67b00
to
0b64873
Compare
This is more inline with community conventions and is the new thoughtbot preference. thoughtbot/guides#237
(you're welcome) |
David Bowie is always welcome. |
This is more inline with community conventions and is the new thoughtbot preference. thoughtbot/guides#237
I know we have had some back on forth on these (e.g. #169 and #237). These preferences were fine when we could automate fixing them with RuboCop. But as we move to standard I think we should buy fully into [standard's opinion on these aliases][standard opinion]. If we don't agree with that opinion, we should discuss the issue on standard instead of in this guide. [standard opinion]: standardrb/standard#39 (comment)
reduce
is gaining popularity in ruby and provides symmetry with ourrecommendation to use
map
.