Feature #7384

Rename #each_with_object to #each_with

Added by Thomas Sawyer over 1 year ago. Updated over 1 year ago.

[ruby-core:49519]
Status:Open
Priority:Normal
Assignee:-
Category:core
Target version:next minor

Description

I propose that #eachwithobject 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 #eachwithobject can remain an alias of #each_with for as long as deemed necessary.


Related issues

Related to ruby-trunk - Feature #6687: Enumerable#with Open 07/02/2012

History

#1 Updated by Benoit Daloze over 1 year ago

I couldn't agree more!

Enumerator#with_object should become Enumerator#with as well.

#2 Updated by Boris Stitnicky over 1 year ago

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

Also available in: Atom PDF