[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Down with Upvalues
- From: Edgar Toernig <froese@...>
- Date: Tue, 28 Aug 2001 21:23:04 +0200
ping "John D. Ramsdell" wrote:
>
> Some of the postings on lua-user.org demonstrate that upvalues are
> very confusing. They confuse some people so much that they think the
> current version of Lua is lexically scoped! Let's get some basics
> straight.
>
> Lua is a statically scoped language in which each variable has either
> local or global scope.
Yeah. Let's get it straight :-)
I think the confusion is on your side because you make a distinction
between lexical and static scoping. It's the same. If you think
I'm wrong give a reference to a text that defines the difference.
By your understanding C (or GCC if you require function nesting) is
not lexically scoped either and a lot of people will disagree.
> Functions can be defined within functions,
> however, a nested function does not have access to variables defined
> in any of its enclosing functions. Therefore, Lua is not lexically
> scoped.
You are focused very much on function nesting. There are more kind of
nesting constructs in Lua (for-do-end, while-end, do-end, ...). Just
because some scope accesses are forbidden/unsupported does not mean
that it's not lexically scoped. What if i.e. Pascal had a "private"
keyword for locals which prohibits access from other functions. Would
this make Pascal no longer lexically scoped?
Ciao, ET.