lua-users home
lua-l archive

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


On Tue, 12 Jan 2010 00:24:06 +0200, Sean Conner <sean@conman.org> wrote:

It was thus said that the Great Juris Kalnins once stated:

I wish there was support for dynamic scoping, too...

Before I weigh in on support for dynamic scoping (and my default position
on dynamic scoping is "no"), what exactly, do you mean by dynamic scoping
(just so I know what's on the table exactly).


When value to variable binding is active while the defining scope is active,
and variable name is globally visible. Like this:

do
  a=1
  do
    a=2
    g() -- access to a gives 2
  end
  -- a == 1
end

In Lua, error handlers (pcalls) have dynamic scoping.