On Wed, May 7, 2008 at 10:15 PM, matt neuburg <matt / tidbits.com> wrote:
> Jens Wille <jens.wille / uni-koeln.de> wrote:
>
>  > Albert Schlef [2008-05-07 21:27]:
>  > > matt neuburg wrote:
>  > >> [...] since the above can be fixed using parentheses:
>  > >>
>  > >> y += (boom rescue "fine")
>  > >
>  > > But if `y += boom rescue "fine"` indeed translates into `y +=
>  > > (boom rescue "fine")` that still doesn't solve the mystery.
>  > no, it evaluates to '(y += boom) rescue "fine"'. the '+=' binds
>  > tighter than/takes precedence over 'rescue'.
>
>  Right, that's what I said. The mystery is why
>
>  y += boom rescue "fine"
>
>  translates to
>
>  (y += boom) rescue "fine"
>
>  but
>
>  y = boom rescue "fine"
>
>  translates to
>
>  y = (boom rescue "fine")
>
>  What I'm saying is: Doesn't the user reasonably expect that = and +=
>  will have similar precedence? I don't really care about this any more,
>  now that I know that I can disambiguate for myself using parentheses;
>  but it feels like a bug, somehow. m.

And worse

y += boom rescue fine

is not equivalent to

y = y + boom rescue fine

that is not what I understand under syntactic sugar, but the behavior
is all the same in MRI1.8 YARV and Jruby, that is not a nice thing.
Well spotted indeed.

Cheers
Robert
>
>
>
>  --
>  matt neuburg, phd = matt / tidbits.com, http://www.tidbits.com/matt/
>  Leopard - http://www.takecontrolbooks.com/leopard-customizing.html
>  AppleScript - http://www.amazon.com/gp/product/0596102119
>  Read TidBITS! It's free and smart. http://www.tidbits.com
>
>



-- 
http://ruby-smalltalk.blogspot.com/

---
Whereof one cannot speak, thereof one must be silent.
Ludwig Wittgenstein