Issue #9251 has been updated by rits (First Last). mame (Yusuke Endoh) wrote: > "!a = true" is an expression as a whole, but the left of = is not an expression, so the rule does not apply here. > The left side is what we call "lhs" in Ruby. Roughly speaking, we can write only a "mutable" subset of the expression in "lhs", such as variable, field access, and array access. > > -- > Yusuke Endoh <mame / tsg.ne.jp> your assertion that rules of precedence don't apply to lvalues although true in practice, is not in the book (at least I have not noticed it), this exception to the general rule, means that the precedence table is wrong/incomplete, since the rules vary by context a = b && c means a = (b && c) but a && b = c means a && (b = c) and a && b = c && d means a && (b = (c && d)) so in the same expression, = has both a higher and lower precedence than &&, depending on which side you look this variation/exception/special casing, ostensibly for convenience, does not in practice help anyone, it's better to have a few clear logical rules, than a multitude of magical exceptions ---------------------------------------- Bug #9251: ! operator has lower precedence than = in an assignment expression https://bugs.ruby-lang.org/issues/9251#change-43708 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/