Skip to content
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 the non-smalltalk version of enumerable methods #169

Closed
wants to merge 1 commit into from

Conversation

sgrif
Copy link
Contributor

@sgrif sgrif commented May 12, 2014

collect and detect are the smalltalk version of these methods, most
other languages use find, and reduce/fold. This is
consistent with the bbatsov guide, as well.

`collect` and `detect` are the smalltalk version of these methods, most
other languages use `find`, and `reduce`/`fold`/`scan`. This is
consistent with the bbatsov guide, as well.
* Prefer `detect` over `find`.
* Prefer `inject` over `reduce`.
* Prefer `find` over `detect`.
* Prefer `reduce` over `inject`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never been a fan of the inject choice. But why not fold?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruby does not define a fold method.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, don't know why I thought it did.

@croaky
Copy link
Contributor

croaky commented May 12, 2014

Nooooo!!! collect and detect rock. Smalltalk rocks. They all rhyme. Keep it all in the ect family.

@mike-burns
Copy link
Contributor

This feels like a case of "pick one and we'll use it", and we've already picked one. Not sure what we gain by picking the other one.

(Also, scan is very different from fold - it's an abstraction over fold, in Haskell at least.)

@jferris
Copy link
Contributor

jferris commented May 19, 2014

@gabebw
Copy link
Contributor

gabebw commented May 20, 2014

I'm Caleb and I like to sass Joe about his stylish polls

@jferris
Copy link
Contributor

jferris commented Jun 23, 2014

There hasn't been a strong majority here:

enumerable-results

I'm going to leave this open for a little while longer.

@sgrif
Copy link
Contributor Author

sgrif commented Jun 23, 2014

Looks like @calebthompson has a doppleganger.

@calebhearth
Copy link
Contributor

Oh shit I haven't even seen this yet.

@mike-burns
Copy link
Contributor

Since there's no strong majority, and since we already have a rule, and since the whole point of our guides is that we can argue things once and never have to think about it again, and since we've already argued this: not sure why we should merge this.

@calebhearth
Copy link
Contributor

Agreed.

@sgrif
Copy link
Contributor Author

sgrif commented Jun 23, 2014

Agreed. Closing.

@sgrif sgrif closed this Jun 23, 2014
@sgrif sgrif deleted the sg-prefer-non-smalltalk-names branch June 23, 2014 15:19
composerinteralia added a commit that referenced this pull request Jun 12, 2020
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)
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.

7 participants