[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Should not integer exponentiation work when it works?
- From: Jay Carlson <nop@...>
- Date: Thu, 9 Jun 2016 21:05:52 -0400
> On 2016-06-09, at 3:24 PM, Egor Skriptunoff <egor.skriptunoff@gmail.com> wrote:
>
> Currently, there is no assurance that the symbol "+" in Lua program will invoke the addition user implied and not the other addition.
> I can't come up with a good idea how to solve this.
> Non-7-bit-ASCII symbols for operations is a bad idea.
> Using "[+]", "(*)" or other complex symbols for integer operations is a bit awkward.
> Using bit64 library will make integer operations boring to use.
The default could be picked for whole blocks. So along with
i = j [*] 2
n = n [+] i
create new syntax to declare what operators mean inside a block:
option math=integer do
i = j * 2
n = n + i
end
I am not thrilled with this, but I've considered a similar facility to allow code to opt-in to making the ".." operator be utf8-safe.
Jay