lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
> Behalf Of Josh Simmons
> Sent: woensdag 12 december 2012 8:41
> Subject: Re: general globals in use
> 
> On Wed, Dec 12, 2012 at 6:20 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> > 2012/12/12 Thijs Schreijer <thijs@thijsschreijer.nl>:
> >
> >>
> >> What I'm mostly interested in is the ones defined 'by convention'. I
> >> think it makes sense to create a generic list on the wiki so they can
> >> be shared (preventing users from creating different generics for the same
> purpose).
> >> And if done properly some might become the standard for the Lua
> >> community, which I think is a good thing.
> >>
> >
> > I'll nominate three, apart of course from names in the standard
> > libraries which should never ever be used for a global with a
> > different meaning.
> >
> > lpeg = require "lpeg"
> > lfs = require "lfs"
> > append = table.insert
> >
> 
> With 5.2 (and 5.1 too, really) pushing towards not registering globals for
> libraries I'm not sure what the advantage of such a list would be as it's going
> to be very heavily application dependent?

Totally right, for globals as Dirk mentiones them (sorry Dirk). That should teach me to formulate my question more precise.
So from my original post;
> Reason for asking; in busted ( http://olivinelabs.com/busted/ ) a global  
> ‘_TEST’ has been in use in the recent released versions. Its use is to 
> allow modules to export additional local/private functions or tables 
> upon requiring them, so they can be tested (only when _TEST ~= nil ).
>
> Question was raised whether this global should be moved to ‘busted._TEST’. 
> Personally I would favor some sort of global agreement on the use of these 
> generic globals, such that in this case also other test suites could use 
> the same global for the same purpose.

So I guess with a 'generic global' what I mean is to set some meta-data (eg. module._VERSION) or configuration options (eg. _TEST as per above).
Surely some of you must also be using constructs like this?

Thijs