[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Putting version information, description, copright into modules
- From: Jonathan Goble <jcgoble3@...>
- Date: Thu, 11 Feb 2016 19:23:43 -0500
On Thu, Feb 11, 2016 at 7:15 PM, Peter Aronoff <email@example.com> wrote:
> Daurnimator <firstname.lastname@example.org> wrote:
>> The other thing to note is that fields starting with '_' are customarily
>> reserved. From http://www.lua.org/manual/5.3/manual.html#3.1:
>> "As a convention, programs should avoid creating names that start with an
>> underscore followed by one or more uppercase letters (such as _VERSION)."
> This has come up more than once in this thread, so here's a question:
> Do people think that variables of this kind are a bad idea even
> when they're namespaced under the exported module's table?
> That is, I use names *exactly* like _VERSION, but not in the
> toplevel environment. Does this still violate the spirit of the
> manual's injunction or is it fine?
I have always interpreted the manual's "convention" as referring
specifically to global names (i.e. fields in _G), since Lua may use
such names for its own purposes (e.g. _G and _VERSION). I've never
interpreted it to mean that such names should be avoided even in
module tables, since Lua itself doesn't use such names anywhere but