[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: changes in 'require'
- From: Diego Nehab <diego@...>
- Date: Fri, 8 Jul 2005 11:42:42 -0400 (EDT)
Hi,
Any reason for this? [require failing on parent modules]
We think it is more simple and more reliable. And we don't see good
arguments against that.
I am assuming that every implicit call to require will behave *exactly*
like the explicit call, trying all loaders too. I.e., given the
structure below,
lib/a.so
share/a/b.lua
lib/a/b/c.so
share/a/b/c/d.lua
a call to require"a.b.c.d" would execute all these files, in order.
The separation of binaries into lib and scripts into share is
in accordance with the Filesystem Hierarchy Standard, I hope.
It is, but as you said, files in lib don't need to be architecture
dependent. It seems much simpler to install a package with all its
modules together under the same directory. (Python, for instance, puts
all its libraries in /usr/lib. Perl too. Tcl too. Your own suggestion
for installing Luasocket puts .so and .lua under the same directory.)
That is because I was unaware we had two directories. I will fix that
in the next release.
1) Lua modules before C.
I think this is retrograde step. [...]
That may be true. We want more input on that topic. About the change
being disruptive, I though that conflicting C and Lua modules should
be the exception rather the norm (as Tomas pointed out).
Maybe it is the price for an extra search that bothers David.
Any functionality implemented in C will be loaded only after
a search for a Lua script failed. It used to be the other way
around.
I have a third suggestion for a change to require:
Don't load the names into the global namespace by default.
Require has never done that. Modules do.
Require is used, by default, to load modules, which call module() by
default, which sets the global namespace by default, right? By
transitivity of the "default" operator... :)
This default behavior is to ensure users can use require in two ways
local a = require"a"
a.b()
and
require"a"
a.b()
and it doesn't bother me too much. Is it easy to override (besides
rewriting module())?
[]s,
Diego.