[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [NoW] Once more about to-be-closed variables
- From: Sergey Kovalev <kovserg33@...>
- Date: Thu, 4 Jul 2019 15:43:00 +0300
Yes indeed. There is no pure function in lua. That's why they are quite rate.
upvalues are almost everywhere that's we are unable to isolate
different part of code.
You have to declare all used variables as local to ensure there is no
side effect, but if you forget to declare some variable
the behaviour will depends on context. Even if we override _ENV
variable to disable access to globals, but we can't disable upvalues.
The only solution is to use "load" function
https://pastebin.com/9jrvzR33 but it isn't perfect.
чт, 4 июл. 2019 г. в 08:01, Egor Skriptunoff <firstname.lastname@example.org>:
> On Thu, Jul 4, 2019 at 12:47 AM Sergey Kovalev wrote:
>> If we would have pure function declaration this problem causes less pain.
>> Pure function like ordinary function but isolated from global and
> Pure functions are quite rare.
> Upvalues are almost everywhere in Lua :-)