[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: require, module, globals and "magic"
- From: Petite Abeille <petite.abeille@...>
- Date: Mon, 16 Aug 2010 14:22:36 +0200
On Aug 16, 2010, at 1:45 PM, Luiz Henrique de Figueiredo wrote:
> Once this magic is removed from module, the very little that
> is left is better made explicit.
Disagree.
While part of the the behavior of lauxlib.luaL_pushmodule might be controversial (mangling global variables), the other functionalities of loadlib.ll_module are useful in and by themselves. Namely, (1) register module with _LOADED (lauxlib.luaL_pushmodule), (2) initialize module's _M, _NAME and _PACKAGE (loadlib.modinit), (3) execute options (lauxlib.dooptions), and (4) set the _ENV of the caller to be the module (lauxlib.set_env).
Keep these functionalities. Get rid of luaL_pushmodules' lua_pushglobaltable if you must.
- References:
- require, module, globals and "magic", Nevin Flanagan
- Re: require, module, globals and "magic", steve donovan
- Re: require, module, globals and "magic", Lorenzo Donati
- Re: require, module, globals and "magic", steve donovan
- Re: require, module, globals and "magic", steve donovan
- Re: require, module, globals and "magic", Luiz Henrique de Figueiredo