lua-users home
lua-l archive

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




On Feb 7, 2018 18:30, "Sean Conner" <sean@conman.org> wrote:
It was thus said that the Great Dibyendu Majumdar once stated:
> On 28 January 2018 at 16:40, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:

> 1. Should I force all libraries to have a require string that is of
> the format 'supplier.module' ? The problem in enforcing this is that
> it makes the distro incompatible with existing code. A better approach
> may be to use the require string that the module provides but prohibit
> any other use of the same module path. This is easy as I have control
> over which libraries go in.

  What is the concern here?  So far, Lua has managed without a conherent
namespace for modules.  If Ravi is meant to run existing Lua code then you
pretty much *can't* enforce a new requirement.

You can have multiple namespaces covering the same objects in Lua. So along with

  pl = require "pl"

I could have

  pl = nop_require "general/penlight"

which return the same object. Presumably you bootstrap the second with 

  nop_require = require "nop_require"

I think the painful issue then is fighting over how the underlying loader handles "real" module names in the "loaded modules" table. There could be other landmines too, though.

-- 
Jay