[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Special do/end block that raises an error on free names - Proof of concept
- From: Sergey Kovalev <kovserg33@...>
- Date: Mon, 22 Jul 2019 18:33:54 +0300
пн, 22 июл. 2019 г. в 18:18, Coda Highland <chighland@gmail.com>:
>
> Because upvalues are resolved at compile time. They're not free names.
This patch is for compile time checking. Any there is ability to
distinct between local and upvalue. Just look inside lparser.c
> Sadly, this means that this patch really doesn't do much more for you than strict.lua aside from being able to control which blocks it applies to.
That's why I write my own patch for pure function
http://lua-users.org/lists/lua-l/2019-07/msg00142.html
x="global"
local y="upvalue"
function fn(G,z) pure
local a
G.print(z)
G.print(G.x)
function a() G.print(y) end -- here compile error: no access to 'y'
end
fn(_G,123)
So you know that you are missing "local y" declaration is this scope.