lua-users home
lua-l archive

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



On 28-Oct-04, at 12:13 PM, David Given wrote:

In fact, the compiler *could* notice the fact that a isn't used any more and so reuse the same stack slot for a different variable. I don't know whether
it does or not; it's a fairly obvious compiler optimisation.

Yes, it could. But it doesn't, currently; it's a one-pass compiler.

It is not quite so easy as it looks, by the way.


local a = MakeAnEnormousTable()
local function foo(x)
  return a[x]
end
-- no more references to a, but foo is still available.
local b = "Hello, world"
print(foo(b))
--...