[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: compile-time globals
- From: Thomas Lauer <thomas.lauer@...>
- Date: Tue, 21 Aug 2007 12:50:29 +0100
Miles Bader <email@example.com> wrote:
> Thomas Lauer <firstname.lastname@example.org> writes:
> > It seems either a separate lint and/or those runtime checks are the
> > way to go.
> It'd be nice if the runtime checks were as cheap as possible though --
> e.g., _G actually contains the global values and doesn't incur an
> __index call for every lookup!
__index isn't called for *every* lookup. It's only called if the field
that's referred to doesn't yet exist. Most accesses into _G are not
touched by the strict module.
But if you know of ways to make this more efficient I'd love to hear
> Looking at the example "strict" module, it calls "debug" module stuff,
> which seems a little bit dodgy to me (I generally have the idea that
> the debug module shouldn't be used when not debugging...).
In theory I agree. In practice there seems to be no other documented way
to get the information where a variable "is coming from".
I agree with the general sentiment that this way of doing checks is sort
of a hack, that's exactly why I was looking for something cleaner.
web : http://thomaslauer.com/start