[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua registry, environment, and threads.
- From: Mike Pall <mikelu-1001@...>
- Date: Fri, 8 Jan 2010 14:25:31 +0100
Roberto Ierusalimschy wrote:
> > Roberto Ierusalimschy wrote:
> > > Modules can be written as "in module(...) do <body> end", with the
> > > module function returning the module table.
> >
> > Does this mean module() will no longer change the environment of
> > its caller? If yes, this means *all* existing Lua source code
> > using the module() function will break.
>
> It will still change the environment of its caller, but for
> compatibility only. This will be a documented compatibility behavior,
> because it affects new code. (Outside the "in module() do ... end" you
> will still be inside the module...)
I guess someone will be surprised by this then:
in module("foo") do
...
end
print() -- Fails rather unexpectedly.
Note that compatibility features you turn on in the standard
distribution are de-facto turned on in all installations (as I've
explained before).
--Mike
- References:
- Lua registry, environment, and threads., Christian Tellefsen
- Re: Lua registry, environment, and threads., Patrick Donnelly
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Christian Tellefsen
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Mark Hamburg
- Re: Lua registry, environment, and threads., Patrick Donnelly
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Mike Pall
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy