Log In  


It looks like the preprocessor expansion of the arithmetic assignment operators breaks a traditional expectation of precedence:

x += true and 1 or 2

expands to:

x = x + true and 1 or 2
-- runtime error: attempt to perform arithmetic on a boolean value

where "x + true" binds more tightly than "true and ...". The fix is to use parens in the expansion:

x = x + (true and 1 or 2)

The workaround is to use parens around the original rhs.



I've been running into this during the jam. I'm wrappin' eeeerrrything in parentheses. :D


I thought zep fixed this a few versions back...

But no, now that I try, you're right. It's still broken, at least when there are boolean operators at play.

@zep ... ?



[Please log in to post a comment]