On Tue, 8 Sep 2009 11:59:01 +0200, Jerome Vuarand <jerome.vuarand@gmail.com> wrote:
> Unfortunately, not too many modules are written this way, because it can be
> awkward to do so. A lot of modules create a table with a name that is fixed
> in the source code for the module. In fact, modules that use the Lua module
> function do this.
That last point is not accurate. Modules that use the "module"
function don't have to use a fixed name when calling it. You can
simply forward the name passed to the module loader to the "module"
function. Most of my Lua modules start with this line:
module(..., package.seeall)
Yes, you make a good point. The Lua module system is quite flexible and this is a good demonstration. I forgot about this technique when I wrote my last post to this list. As I did say in that post, I like it when a module lets me assign the table name that will contain the module functions.
Either you knew it and you purposefully omitted to mention it, or you
didn't and in that case you may have underestimated the possibilities
of the existing Lua module system. In both cases something feels wrong
to me.
It's certainly not polite to imply that I purposefully omitted this point. Do you realize that by suggesting it, you are assaulting the integrity of a person that you do not even know? Perhaps you were in a foul mood, or feeling needlessly defensive.
In my omission, I did imply a lesser degree of flexibility in the Lua module system than actually exists. I regret the error.
Nevertheless, I do not believe the omission undermines the rationale for creating an enhancement to the current module system. The reasons are many and deep, while the omission was singular and shallow.
Jim