[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Making Lua lexically scoped (was: Re: Proper tail recursion)
- From: ramsdell@... (John D. Ramsdell)
- Date: 30 Jul 2001 08:15:33 -0400
A language is either lexically scoped or it is not. Adding the
adjective "proper" to the phrase "lexical scoping" is meaningless.
Adding the adjective "true" to the phrase "lexical scoping" is
meaningless. Languages such as Algol, Pascal, Ada, Scheme, and Python
2.2+ (I suspect) are lexically scoped, while languages such as C,
Fortran, AWK, Elisp, and Lua as of 4.0 are not lexically scoped.
Roberto Ierusalimschy <roberto@inf.puc-rio.br> writes:
> > I was not pleased to see the claims made on pages 22 and 45, that
> > Lua is lexically scoped.
>
> I will correct that on page 22. On page 45, as you already quoted, I
> do not say that Lua is lexically scoped, but that it "has a form of
> proper lexical scoping through upvalues".
My point was that since Lua is not lexically scoped, it does not have
a form of proper lexical scoping, whatever that means. Lua is
statically scoped with local and global variable references, and a
construct that gives Lua programmers some of the benefits of lexical
scoping while allowing efficient implementations of the language.
By the way, the more I think about the suspected Python method for
making that language lexically scoped, the more I like it. That is, I
like the idea that a language is lexically scoped, but as sacrifice to
allow efficient implementations, variables become immutable whenever
they are referenced by a closure. This language design is in the
spirit of Lua's simplicity, and would allow the complexities of
upvalues to be purged from the language.
John