lua-users home
lua-l archive

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


okay so a while back I talked about this "unset foo" idea, that would allow you to get through to shadowed names.

the example I gave was basically:

local foo = 1
do
  local foo = 2
  do
    unset foo
    foo = 3
  end
  assert(foo == 2)
end
assert(foo == 3)

(I don't remember the exact examples I gave but I like this one.)

anyway, nobody liked it back then and I don't expect anyone to like it now.

but since we're talking about __close and toclose and stuff, why not use __unset instead? it's called when a variable is unset i.e. goes out of scope. (as long as we don't get the ability to unset variables like I proposed with non-linear lexical scoping, at least.)

it still doesn't solve the "what to name the <toclose>" problem, but, I'd prefer __unset over __close, personally. (ideally we'd also have a __set for when the value is assigned to one of those special variables, but I digress.)