[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: A major problem with the Lua ecosystem
- From: Sean Conner <sean@...>
- Date: Fri, 2 Feb 2018 17:35:57 -0500
It was thus said that the Great Dibyendu Majumdar once stated:
> On 2 February 2018 at 22:18, Sean Conner <email@example.com> wrote:
> > It was thus said that the Great Dibyendu Majumdar once stated:
> >> On 2 February 2018 at 22:00, Sean Conner <firstname.lastname@example.org> wrote:
> >> > Lua modules written in Lua can be renamed easily---just change the name of
> >> > the file . Modules written in C can't be renamed without a code change
> >> > due to possible linking restrictions ---Lua looks for
> >> > "luaopen_modulename" when loading a C-based module.
> >> I was thinking that require should allow an optional module name -
> >> i.e. lookup as now, but use the module name (if given) when saving the
> >> reference. That way, the name of the module inside Lua becomes
> >> independent of how the module was resolved.
> > Example? My own syslog module is in C, and the exported symbol is
> > luaopen_org_conman_syslog
> something like:
> local syslog = require ('org.conman.syslog', 'conman.syslog')
> So that Lua uses 'conman.syslog' to register the library in package.preload.
> I haven't really thought this through but it should convey the idea.
> Of course this is still problematic because someone has to require it
> with the desired name - then other references can use 'conman.syslog'.
> So it probably doesn't work.
Related is this thread, from 2013: