[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: New feature for lua
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 5 Apr 2019 08:30:24 +0200
On Fri, Apr 5, 2019 at 8:12 AM Sergey Kovalev <kovserg33@gmail.com> wrote:
>
> Let inroduce new reserved word "pure_function" into lua.
> It should work similar to usual function except
> all variables used inside are implicitly local
> no access to any upvalues or global namespace _G
> So it could interact with arguments it was passed.
The 'implicitly local' bit will be a surprise to people, I think.
Global-as-default has mostly served us well.
I'm wondering if this could not be done just as a check using bytecode
- i.e. annotate a function as 'pure' in some way and look at the
bytecode to see if it has any upvalues or globals referenced.