[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Operator precedence and unary minus
- From: Albert Chan <albertmcchan@...>
- Date: Mon, 21 May 2018 18:32:43 -0400
> - a%m - b%n ~= - b%n - a%m
> It's looks very weird
Remove space between unary minus and variable,
and some parenthesis, it does not look weird
(-a % m) - (b % n) ~= (-b % n) - (a % n)
You can do the same trick to make any expression weird:
a * b+c * d+e / a ^ 3*c
> I think it would be good to lower the priority of unary minus in Lua.
> For example, unary minus may have the same priority as binary minus.
>
> -- Egor
Even if the idea is sound, it is too late to fix precedence
Anyway, how can it parse simple x / -y ?