[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 11:24:51 -0400
"Peter Prade" <prade@phenomic.net> writes:
> Jay Carlson comments on John Ramsdell:
> >> 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 gives me the creeps. To understand whether something is writable or
> >not you can't just look at its declaration; you have to inspect all of the
> >code inside its defining block.
>
> I wholeheartedly agree, the current solution at least clearly marks those
> upvalues as something special and readonly.
I believe programs written in a good scripting language should be
easily read by people only casually familiar with the language. With
the exception of upvalues, I think Lua excels in this respect as it
adopts Pascal-like syntax for control structures whose meaning is just
what one would expect. Programs that employ upvalues are unlikely to
be understood by casual users. One needs a manual to understand when
they get their value. Most people intuitively understand lexical
scoping. Making variables immutable when they are referenced in
closures puts a burden on the authors of a Lua program, but not on
readers of the program. I think Lua should be designed to meet the
needs of readers foremost.
John