[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [proposal] A statement that can return value (and can used in expr)
- From: Miles Bader <miles@...>
- Date: Wed, 14 Dec 2011 13:33:32 +0900
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.