[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: The 4 negations of Lua
- From: Coda Highland <chighland@...>
- Date: Fri, 16 Sep 2016 14:45:42 -0700
On Fri, Sep 16, 2016 at 2:38 PM, Soni L. <firstname.lastname@example.org> wrote:
> A boolean is a 1-bit number. An integer is a 32- or 64-bit number.
> Bitwise not applies to both.
> Bitwise not on a boolean is ((~TRUE)&1), which produces the same value as
> And Rust uses ! for both bool not and bitwise not, granted it does have a
> complex and potentially turing-complete type system.
A boolean is not a 1-bit number in Lua. You can't perform arithmetic
with true and false. Furthermore, integer 0 does not evaluate as
boolean false in Lua.
You could say a boolean CAN be represented as a 1-bit number, but
that's incompatible with everything else booleans do differently in
(Aside: Booleans are 1-bit numbers in C99 and C++, but the ~ operator
doesn't operate on anything smaller than an int, so in those languages
~true != !true.)