On Mar 4, 2004, at 8:49 PM, Hal Fulton wrote:

> Robert Peirce wrote:
>> On Mar 4, 2004, at 8:03 PM, Mehr, Assaph (Assaph) wrote:
>>> Ruby aliases are just making an object respond to a different name 
>>> with an existing method; not expanded like shell aliases.
>>>
>>> If I understand correctly when the parser sees: 2 + 5
>>> It actually performs: 2.+ 5
>>> i.e. send the '+' method to the FixNum object for 2, with a 
>>> parameter of 5.
>> Okay, but why doesn't it do the same when it sees 2 plus 5?  
>> 2.plus(5) and 2.plus 5 both work but 2 plus 5 does not.
>> I'm not saying it should; I'm just wondering why it doesn't.  I don't 
>> really understand what is going on when you use
>> aliases.
>
> Aliases aren't macros, and the parser doesn't have the artificial
> intelligence to rewrite itself every time you use one.
>
> An ordinary method name can only be called with the .meth notation.
> That's a syntax issue.
>
> As a bonus, Ruby allows intuitive shorthand making certain methods
> look like the operators they represent/are. So that instead of
> saying 3.+(5), we're allowed to say 3 + 5. That's also a syntax
> issue.
>
> The mere fact that an alias refers to a method that happens to have
> an infix shorthand doesn't mean that the Ruby parser is now magically
> able to recognize infix method names.
>
> Does this help any?
>

Thank you.  That explains the situation exactly.  If I understand you 
correctly, 2 + 5 is a hard-wired construct that really represents 2.+ 5 
or 2.+(5).  Consequently, when I alias plus to '+', I am limited to 
what the ruby parser can normally do, and cannot use what it may be 
hard-wired to do.