[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (work4) now available
- From: Jonathan Castello <twisolar@...>
- Date: Fri, 6 Aug 2010 13:52:29 -0700
On Fri, Aug 6, 2010 at 1:43 PM, Petite Abeille <petite.abeille@gmail.com> wrote:
> Well, not much magic, just a bit of policy.
This 'policy' doesn't allow you to make the module local only, which
is one of the reason I don't use module().
> I'm not quite sure where this notion of "magic" comes from? Is that related to its use of setfenv? Is the demise of module related to setfenv passing out of favor?
I believe there were some e-mails recently about moving to a policy of
minimizing globals. It stemmed from a locals vs globals discussion,
IIRC.
As for 'magic', I mean that it's not immediately obvious how it works
compared to the rest of Lua. It does mischievous things behind the
scenes that at first glance aren't visible.
On another note, I do like setfenv() quite a bit, and I even use
newproxy() occasionally so I can use the setfenv() on the userdata to
create a slightly-more-private data store. (It also gives me a
convenient place to put data without hindering __index and __newindex
metamethods on the userdata.) setfenv() and newproxy() have no unclear
side-effects when used directly, and it's up to the user of these
functions to use them wisely.
> Lets keep Lua weird :)
I'm all for a weird Lua in general, but when one part of Lua is weird
compared to the rest, I'm not sure that's a good thing.
--
~Jonathan