lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
> Behalf Of Dirk Laurie
> Sent: zondag 23 maart 2014 18:46
> To: Lua mailing list
> Subject: Re: [ANN] Lua 5.3.0 (work2) now available
> 
> 2014-03-23 16:58 GMT+02:00 Thijs Schreijer <thijs@thijsschreijer.nl>:
> 
> > I find it confusing that the operator '~' is used for both 'xor' and
> 'unary not'.
> 
> Think of it this way. Prefix `-` is related to infix `-` by the identity
> 
>    -x == 0-x
> 
> Prefix `~`, as your examples so clearly demonstrate, is related to infix `~`
> by
> 
>    ~x == (-1)~x
> 
> since -1 == 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

Thx. I understand the logic. But still would find '!' clearer for a unary not.
Thijs