lua-users home
lua-l archive

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

John D. Ramsdell wrote:
> 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.

I though that I understood what "lexically scoped" means, but I am not sure
Why C isn't lexically scoped? Is it because you can't define functions
inside functions, like in Pascal or Ada? (I don't know the other languages.)

> 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.

Still trying to learn (the easy way ;-):
What do you mean by "referenced by a closure"?
Actually, I am not sure to understand what a closure is. But I suppose it is
like the upvalues: a view on the values of variables at function evaluation
(by parser? by VM?) time.
Then, referenced by a closure should be eg. the upvalue syntax.

How wrong am I?
Sorry to interrupt by stupid questions, but when I studied computer science
(some fifteen years ago), nobody told me about functional programming and
such. I hardly had a look at Lisp and Prolog by then...


Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist

Sent through GMX FreeMail -