[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Creating closures (or not)
- From: Geoff Leyland <geoff_leyland@...>
- Date: Tue, 13 Jul 2010 06:39:53 +1200
On 13/07/2010, at 6:35 AM, Peter Cawley wrote:
> Wherever you see "function", a closure is created. Otherwise you
> wouldn't be able to set the environment of the resulting function
> without affecting other functions.
Thanks Peter! That makes sense (in hindsight...). In that case, does
function f()
return function() end
end
f(); f(); f(); f(); f()
create more heap objects than
local function g() end
function f() return g end
f(); f(); f(); f(); f()
?
Geoff