[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: About function environments
- From: Daniel Silverstone <dsilvers@...>
- Date: Tue, 07 Oct 2003 14:33:40 +0100
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.
D.
--
Daniel Silverstone http://www.digital-scurf.org/
Hostmaster, Webmaster, and Chief Code Wibbler: Digital-Scurf Unlimited
GPG Public key available from keyring.debian.org KeyId: 20687895