I use it for compatibility purposes the args part is just the name of the variable; what matters is the * operator. You can think of it as collapsing an array, so if you have an array like:
coords = [x, y, z]
a, b, c = *coords # a = x; b = y; c = z
It also works in reverse, so *coords = x, y, z # coords = [x, y, z]
I use it in both ways where I am aliasing. It first takes all of the arguments passed to a method and puts them in an array (called args, but again you could name it anything). I then collapse that array and pass those arguments through the original method call.
So:
alias new_method old_method
def old_method (*args)
new_method (*args)
end
I think it helps for compatibility, because you don't need to know what arguments that method is expecting if you don't need to use them. Because consider this situation:
Original method:
def old_method (x, y)
# Stuff
end
And then another scripter comes along and decides he wants to add another argument he/she can pass to this method for his/her own purposes, so he/she writes this:
alias new_method old_method
def old_method (x, y, z = 0)
new_method (x, y)
# Stuff
end
So far everything is dandy. It will work everywhere. But then another scripter comes along and writes this:
alias new_method2 old_method
def old_method (x, y)
new_method2 (x, y)
# Stuff
end
Now, wherever in the first scripter's code that he passes the extra argument to old_method there will be an argument error because he's passing three arguments to old_method when it only takes two. Now that would be a very easy error to correct since all anyone would need to do is put the second script above the first script in the Editor, but it's not hard to imagine more serious incarnations of this and in any case, most RM users aren't overly adept at solving errors in their scripts. So, as long as you're not using the arguments passed to the method you alias, then you might as well use *args in order to avoid potential argument errors.