From: Kassym Dorsel Date: 2011-12-02T12:15:40+09:00 Subject: Why are there so many similar/identical methods in core classes Let's look at the Array class and start with method aliases. There are two aliases : .to_s <=> inspect , .size <=> .length , index <=> find_index. I understand the need for the first one, since sometimes the two don't return the same thing depending on the class. But why have size/length do the exact same thing..? This is one pretty intuitive so it's not that bad.h Then we have methods that are defined together, but with different names : collect <=> map , [] <=> slice <=> at. Next we have methods that seem to be doing the same thing, but are implemented differently : keep_if <=> select! , reject! <=> delete_if , delete_at <=> slice! <=> shift Next are the nearly identical methods. They are the same except one does a little : count <=> length/size Useless methods? : replace. Why do you need an explicit method for this. Can't you just use the assignment operator ? These are just the ones I remember/found. I'm sure there are many more examples in this class and others. Doesn't having multiple names for the same thing make it confusing when collaborating ? Is there any reason for this ? What is your take on the matter ? -- Posted via http://www.ruby-forum.com/.