lua-users home
lua-l archive

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

On Fri, Aug 05, 2005 at 04:32:06PM -0300, Roberto Ierusalimschy wrote:
>   int foo () { a = 1; }
> in C, C++, C#, Pascal, Objective Pascal, Ada, Java, Scheme, Lisp (and a
> lot of other languages), do you think that "a" is local to the function?
> Or does it look more like a global (that is, external to the function)?

I don't think it's instructive to compare default scope in languages
with implicit variable declaration to languages with explicit declaration:
in the latter, there is no default at all, since you're forced to give
it explicitly.

At least in C++, I don't assume that "a" is anything; it could be a
global or a member variable, and it's obviously not local, but it's
wrong, IMO, to say "since it's not local, it's like Lua with global
defaults".  :)

Glenn Maynard