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.

P#48604 2018-01-27 18:27 ( Edited 2018-01-28 06:39)

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

P#48609 2018-01-27 22:24 ( Edited 2018-01-28 03:24)

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 ... ?

P#48613 2018-01-28 01:39 ( Edited 2018-01-28 06:39)

[Please log in to post a comment]