On Thu, Nov 18, 2010 at 11:23 PM, Miles Bader <miles@gnu.org> wrote:
Nick Gammon <nick@gammon.com.au> writes:
What is the motivation for the ALL CAPS function names in the bit library?
My guess it is to avoid the use of the reserved words "and" and "or".
However it does look UGLY.
Yeah; "band", "bor" etc are hardly _pretty_, but they're at least
somewhat familiar and normal-looking. AND, OR, etc, just stand out
absurdly in code, and scream for attention.
With code having lots of bitops, I'd probably do things like
local OR = bit.bor or bit32.OR -- prefer JIT-optimized ops
local AND = bit.band or bit32.AND
local NOT = bit.bnot or bit32.NOT
...
if not t or NOT(OR(x,y)) == 1 and AND(z,w) == 0 then ... end