lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On 18/08/15 02:18 PM, Javier Guerra Giraldez wrote:
On Tue, Aug 18, 2015 at 12:14 PM, Soni L. <fakedme@gmail.com> wrote:
Can we get expressionblocks?
AKA functions:

local v = (local function() return 3 end)()



Basically, but without the GC overhead of creating closures, or the VM overhead of calling functions.

Alternatively:

do
<block>
export local <namelist> = <explist>
end

Where `export` would create the locals on the outer scope. This is useful when creating closures without polluting the environment.

--
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.