lua-users home
lua-l archive

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


David Manura <dm.lua@math2.org> writes:
> On Tue, Dec 13, 2011 at 3:39 PM, Xavier Wang <weasley.wx@gmail.com> wrote:
>> local c = 10
>> local function f(a, b) print "a statement" return a + b + c end
>
> In 5.2, you'll need to translate that code to pass c as a parameter to
> f if you want it to reuse the closure.  Lua 5.2 presently does not
> take full advantage of all optimizations available on this.  I made
> some comments on that on the bottom of [1].

Still, it seems to use a pretty intuitive and easy-to-follow rule for
when to re-use closures, which I expect will usually just turn out to do
the right thing...

-Miles

-- 
Back, n. That part of your friend which it is your privilege to contemplate in
your adversity.