[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Globals (more ruminations)
- From: steve donovan <steve.j.donovan@...>
- Date: Sun, 11 Jul 2010 16:40:59 +0200
On Sun, Jul 11, 2010 at 4:20 PM, Florian Weimer <email@example.com> wrote:
> Do you think it would be an issue if scripts still could create and
> update a variable such as http.socket? That would be a non-global
> access at the bytecode level, but it still would introduce coupling.
> Should modules be read-only from a user's point of view?
I suspect most globals in Lua programs are precisely these
module-scope variables. They are of course just as global in effect as
They can be made into pseudo-variables (essentially static properties
of the module), so that the variable socket.http is actually the
getter and setter part socket.get_http() and socket.set_http()) and
then they can be backed by thread-local storage)
Modules are 'open' to further modification, being dynamic constructs.
It would be useful to be able to declare them as 'sealed' (it
wouldn't be difficult to define 'package.sealed' as a modifier for