On 2018-03-20 01:57 AM, Dirk Laurie wrote:
2018-03-20 0:38 GMT+02:00 Soni "They/Them" L. <fakedme@gmail.com>:
Let's talk about non-lexical lexical scopings. That is, the ability
to undefine variables.
,,,
forget a
...
local a, a, a = 1, 2, 3
This assumes something about implementation of multiple assignment
that Lua does not promise.
...
Those are 3 different locals.
local a, a, a = 1, 2, 3
*is*
local a = 1
local a = 2
local a = 3
(however, the order in which they are assigned is undefined [1])
But, this is different from
a, a, a = 1, 2, 3
Which is undefined, and could be any of:
a = 1
a = 2
a = 3
a = 3
a = 2
a = 1
a = 1
a = 3
a = 2
etc, you get the idea.
[1] - Using non-lexical scoping, local a, a, a = 1, 2, 3 could be
expanded to any of:
local a
local a
local a
do
forget a
forget a
a = 1
end
do
forget a
a = 2
end
do
a = 3
end
-- or
local a
local a
local a
do
a = 3
end
do
forget a
a = 2
end
do
forget a
forget a
a = 1
end
-- etc
They are still 3 locals, declared in order, with the 3 values also
declared in order.