Yukihiro Matsumoto wrote:
> Hi,
> 
> In message "Re: [ ruby-Bugs-6468 ] the sign of a number is omitted when squaring it. -2**2 vs (-2)**2"
>     on Sun, 5 Nov 2006 04:23:30 +0900, Joel VanderWerf <vjoel / path.berkeley.edu> writes:
> 
> |Any yet
> |
> |irb(main):002:0> -2.abs
> |=> 2
> |
> |So there are cases where the operation of "concatenating characters to 
> |form a literal" has higher priority than an operation on objects.
> 
> People with mathematical background demands precedence for ** being
> higher than that of unary minus.  That's the reason.

Precedence isn't the whole story:

irb(main):001:0> x=2
=> 2
irb(main):002:0> -x**2
=> -4
irb(main):003:0> -2**2
=> -4
irb(main):004:0> -x.abs
=> -2
irb(main):005:0> -2.abs
=> 2

Tokenization works differently in different contexts (as it should). 
Mathematicians need to learn this, when they read line 005 above.

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407