[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Basic question about modules
- From: Matthew Wild <mwild1@...>
- Date: Tue, 5 Oct 2010 15:07:49 +0100
On 5 October 2010 14:56, Thijs Koerselman <firstname.lastname@example.org> wrote:
> On Tue, Oct 5, 2010 at 3:11 PM, steve donovan <email@example.com>
> Aha so _ENV is implicitly used as the environment for any global variable,
> and if you re-declare _ENV yourself, like you do above, any global after
> that automagically ends up in that table. By declaring _ENV as local in a
> module, all exported names are kept in a local table and are not polluting
> global namespace. Any function or variable declared local in the module will
> not appear in the _ENV export table because only the globals end up there.
> If I understand this correctly, the above approach is backwards compatible
> with 5.1 if you add setenv(1, _ENV) after the first line, right?