[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Putting version information, description, copright into modules
- From: Peter Aronoff <telemachus@...>
- Date: Fri, 12 Feb 2016 12:36:10 -0500
Philipp Janda wrote:
> I'm sure we all agree that a general table should be able to hold any
> string key including ones starting with _ + uppercase letter. However,
> a module table is not a general table, and there already has been Lua-Rio
> code in Lua 5.1 that used the `_M`, `_NAME`, and `_PACKAGE` fields in
> module tables, so the reservation of those names probably does not apply
> to global variables (and the registry) only.
But those tables and the tables that my module exports are by definition
distinct, aren't they? I'm worried that I'm missing something painfully
obvious, but I don't see how a clash could occur. A user of my module has
to require the module and save the table it returns, using an identifier.
That identifier holds one specific table and is distinct from any other
table from Lua-Rio or any other code.
More concretely:
local split = require('split')
if split._VERSION == 'whatever' then
whatever()
else
whatever_else()
end
How can the _VERSION identifier in the one table ever clash with one in
another table?
--
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:
- Putting version information, description, copright into modules, Marc Balmer
- Re: Putting version information, description, copright into modules, Daurnimator
- Re: Putting version information, description, copright into modules, Peter Aronoff
- Re: Putting version information, description, copright into modules, Roberto Ierusalimschy
- Re: Putting version information, description, copright into modules, Peter Aronoff
- Re: Putting version information, description, copright into modules, Roberto Ierusalimschy
- Re: Putting version information, description, copright into modules, Peter Aronoff
- Re: Putting version information, description, copright into modules, Philipp Janda