[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Non-uniqueness of module names
- From: Peter Aronoff <telemachus@...>
- Date: Thu, 18 Apr 2019 14:49:20 -0400
Hisham <h@hisham.hm> wrote:
> Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> >
> > > I would be more comfortable with _VERSION, with the Lua interpreter
> > > itself, as "master module", already adhering to that convention :-)
>
> The Lua interpreter does things that modules are not supposed to do,
> such as loading a bunch of globals. It is an example of "main program"
> behavior, not "module behavior".
>
> > +1.
>
> But what about what the Lua reference manual says about using names of
> that sort:
>
> "As a convention, programs should avoid creating names that start with
> an underscore followed by one or more uppercase letters (such as
> _VERSION)."
>
> It even uses _VERSION as the example of what _not_ to do!
Thanks for asking this question, Hisham! I was too shy, but I had the
exact same thought. A few years ago, I rewrote all my modules *not* to use
_VERSION, _AUTHOR, etc.[1]
Maybe I didn’t need to rewrite them after all?
Best, P
[1] What I do now is export functions version(), author(), etc. It works
out pretty much the same.
https://github.com/telemachus/split/blob/master/src/split.lua#L129-L143
--
We have not been faced with the need to satisfy someone else's
requirements, and for this freedom we are grateful.
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System
- References:
- Non-uniqueness of module names, Dirk Laurie
- Re: Non-uniqueness of module names, Roberto Ierusalimschy
- Re: Non-uniqueness of module names, Abhijit Nandy
- Re: Non-uniqueness of module names, Sean Conner
- Re: Non-uniqueness of module names, Dirk Laurie
- Re: Non-uniqueness of module names, Gerhard Sittig
- Re: Non-uniqueness of module names, Luiz Henrique de Figueiredo
- Re: Non-uniqueness of module names, Dirk Laurie
- Re: Non-uniqueness of module names, Roberto Ierusalimschy
- Re: Non-uniqueness of module names, Hisham