lua-users home
lua-l archive

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

On Tue, 2003-10-07 at 13:06, Roberto Ierusalimschy wrote:
> No strong reason. Mainly we felt that C functions do not need this
> facility, because in C it is almost as easy to access any table field
> as to access a global variable. Moreover, we did not want Lua to be able
> to change the way a C function works (by changing its environment).

I see. It's almost a pity, because it'd be nice for the function
environment thing to be orthogonal across C and Lua functions.

If a C function needs to be sure it's getting the real globals table
rather than whatever its environment is, then it can bind the globals
table into its closure when the function is created, just like you can
with lexically scoped variable values in Lua functions.

Just my $0.02 of course.


Daniel Silverstone             
Hostmaster, Webmaster, and Chief Code Wibbler: Digital-Scurf Unlimited
GPG Public key available from       KeyId: 20687895