It is to make Ruby a language that is more natural. As a dev, I love it
when things __JUST_WORK__ and ruby does aliases to make that happen.

On Thu, Dec 1, 2011 at 10:15 PM, Kassym Dorsel <k.dorsel / gmail.com> wrote:

> 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/.
>
>


-- 
Sincerely,

Isaac Sanders
Section C-4B Vice Chief, Order of the Arrow
Vice Chief of Administration, Tecumseh #65
Eagle Scout