[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Module system curiosity
- From: Matthew Wild <mwild1@...>
- Date: Sun, 30 May 2010 15:28:14 +0100
On 30 May 2010 12:37, Florian Weimer <firstname.lastname@example.org> wrote:
> It seems to me that the 5.1 module system does not actually provide
> the type of modulariziation with which I've grown to be familiar.
Yay, come and join me at shouting at a brick wall ;)
See when I last brought this issue up:
http://lua-users.org/lists/lua-l/2010-01/msg00411.html (the thread is
an interesting read, even though it doesn't present an effective
I rank this as my #1 most troublesome design flaw in Lua. Nearly every
other problem can be worked around (even perhaps with downsides like
loss of performance). However it seems this issue cannot.
I posted in that thread some code I have been using to restrict
require()/module() to the current environment. However this week I
learnt that my code fails to catch some cases. Namely luaL_register,
when called with a module name like "foo.bar". In this case
luaL_register uses luaL_findtable() which in turn uses lua_rawget(),
completely bypassing the metatable magic (and as far as I can see,
failing to load the module entirely). An example I've found of such a
library that breaks when using this code is LuaCrypto.
I would dearly love for this to be amended in 5.2, but it seems the
issue of "how" is under debate.