Issue #9251 has been updated by shyouhei (Shyouhei Urabe).


rits (First Last) wrote:
> shyouhei (Shyouhei Urabe) wrote:
> > So this is a doc issue.  The book is wrong here.
> 
> How can you be sure? Matz hasn't weighed in.

I am sure becasue I know it was matz himself who wrote this particular syntax long before the book.

https://github.com/ruby/ruby/blame/trunk/parse.y#L854
----------------------------------------
Bug #9251: ! operator has lower precedence than = in an assignment expression
https://bugs.ruby-lang.org/issues/9251#change-43696

Author: rits (First Last)
Status: Feedback
Priority: Low
Assignee: 
Category: doc
Target version: 
ruby -v: ruby 2.0.0p353 (2013-11-22 revision 43784) [i686-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


irb(main):001:0> !a = 1
(irb):1: warning: found = in conditional, should be ==
=> false
irb(main):002:0> a
=> 1

! is supposed to have higher precedence than =, so !a = 1 should be (!a) = 1, and thus an error, not !(a = 1) 



-- 
http://bugs.ruby-lang.org/