lua-users home
lua-l archive

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


I see you point, but I actually think that it's not so unusual that people
start to create Lua packages composed of different sub-modules (e.g.
mymod.core and mymod.error) that are loaded by a require 'mymod'. Course,
you can always deal with odd situations by changing module metatables or
something like that, but maybe the best thing is focus on most common use.
Additionally, the rawget does not avoid peculiar semantics at __index for
module tables, it just avoid its use at package load (what I think is a
good idea). I don't like that solution at all, but I can live with that if
that's the way it must be. By the way, the behavior in Lua 5.1 work 6
seems to differ. It would be nice to unify these package models.

I guess the most common use is for a developer of a given module to
write his own submodules, or at least realize that someone else might do
it.  At any rate, the getmetatable solution I suggested can be
implemented by either.

Besides, the fact that this __index field is left behind is an unwanted
artifact. I trully believe it should be removed even if you don't plan
to use "mymodule.error" or the like.  After all, the line

    c = socket.socket.socket.socket.socket.tcp()

is ridiculous. :)

We definitely want to unify Compat-5.1 with Lua 5.1. We are trying to
keep up with the work releases and will update to Compat-5.1 release 4
pretty soon. What is is that is different between release 3 and work6
that is bothering you? I haven taken a close look yet.