Project

General

Profile

Actions

Feature #7384

open

Rename #each_with_object to #each_with

Added by trans (Thomas Sawyer) about 12 years ago. Updated almost 7 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:49519]

Description

I propose that #each_with_object be renamed to #each_with, for the following reasons:

  1. The original name is too long. When general purpose methods have long names it tends to deter developers from using them even when they are a good fit to the use case.

  2. The last word, "object", is completely redundant. All methods that take an argument could say the same thing. e.g. Array#push is not named #push_object though that is obviously what it means.

  3. The change need not effect backward compatibility b/c #each_with_object can remain an alias of #each_with for as long as deemed necessary.


Related issues 2 (2 open0 closed)

Related to Ruby master - Feature #6687: Enumerable#withOpenActions
Related to Ruby master - Feature #7340: 'each_with' or 'into' alias for 'each_with_object'OpenActions

Updated by Eregon (Benoit Daloze) about 12 years ago

I couldn't agree more!

Enumerator#with_object should become Enumerator#with as well.

Updated by Anonymous about 12 years ago

+1 for Eregon. #each_with_object is my favorite method, I love and always alias it to #ewo :)

Updated by akr (Akira Tanaka) over 10 years ago

  • Related to Feature #7340: 'each_with' or 'into' alias for 'each_with_object' added
Actions #4

Updated by naruse (Yui NARUSE) almost 7 years ago

  • Target version deleted (2.6)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0