[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Locals by default yet again, sorry :)
- From: pocomane <pocomane_7a@...>
- Date: Tue, 30 Jul 2019 16:48:25 +0200
On Tue, Jul 30, 2019 at 4:37 PM Sergey Kovalev <kovserg33@gmail.com> wrote:
> I try "do <localonly>".It is not similar to noupvalues. It is like
> pure function more.
> I think patch with pure fuction was too vicious in many cases.
> So noupvalues more friendly. It simply hides all upvalues except _ENV.
> But now I cann't say what kind is better.
Yes, it is not fully equivalent, but you can workaround the limitation
with something like:
local env = _ENV -- or local _ENV = _ENV if you prefer
do <localonly>
env.print"ok"
end
However I think <withupvalue> is closer to what Abhijit was looking
for (if he can live without direct access to globals).