lua-users home
lua-l archive

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


On Sun, Mar 23, 2014 at 2:15 PM, Coroutines <coroutines@gmail.com> wrote:
> On Sun, Mar 23, 2014 at 2:06 PM, Hao Wu <wuhao.wise@gmail.com> wrote:
>> On Sun, Mar 23, 2014 at 1:55 PM, Philipp Janda <siffiejoe@gmx.net> wrote:
>>> Am 23.03.2014 21:39 schröbte Thijs Schreijer:
>>>
>>>>
>>>> Thx. I understand the logic. But still would find '!' clearer for a unary
>>>> not.
>>>
>>>
>>> C uses `!` for logical not. It might get confusing if Lua used it for
>>> bitwise not ...
>>
>> there is no "!" in Lua, and ~= is "not equal" in Lua, I would rather
>> find it would be confusing to use "!" for not
>>
>>>
>>>> Thijs
>>>>
>>>
>>> Philipp
>>>
>>>
>>>
>>>
>>
>> Hao
>>
>
> I believe they're saying that it would be confusing in 5.3 to have ~=
> for binary, logical-not and ~ for unary, bitwise-not.
>
> Lua doesn't have compound-assignment operators, so it'll be confusing
> to see both ~item and item ~= whatever

I agree a ~= b and a =~ b would be sometime misread, but those two
statement would appear in two different cases, relational comparison
and assignment.

IMHO, confusing here is relative to our experience with C/C++. As Dirk
pointer out earlier, unary ~ operator can be seen as shorthand xor
without the leading -1. I would just say it will take a while to
switch contexts between C and Lua

>