[Nickle] bug

Keith Packard nickle@nickle.org
Fri, 07 Feb 2003 17:52:37 -0800


Around 1 o'clock on Feb 8, "Ireland Peddlar" wrote:

> x == 0 ? x = 1 : x = 2

btw -- even after the grammar was fixed, this expression isn't valid -- the
?: operator has higher precedence than assignment, so you'll actually be 
compiling:

  ((x == 0) ? (x = 1) : x) = 2

so you'll get an invalid lvalue error.  That just means you'll need parens
around the right assignment:

 x == 0 ? x = 1 : (x = 2)

which looks weird, but follows all of the rules.

-keith