lua-users home
lua-l archive

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


Hi,

Jamie Webb wrote:
> I think I like the LuaCheia method: all modules are fronted by Lua scripts, 
> which may either be the module itself (for pure Lua modules), be a stub which 
> loads a C library using some method, or be a mix of C and Lua. All modules 
> are then consistently loaded using cheia.load().

Another benefit: Searching for dynamic libraries in a large library path
may be quite expensive, depending on the OS. This means we get a net benefit
if we assume that a 'grown-up' Lua library collection has more Lua code than
C code (as the Python and perl precedents show).

But we still need to clear up 'loads a C library using some method'.
An approach that does not require hardcoding system dependencies in the
stub would be nice. Added bonus if the stub can be a symlink. :-)

BTW: A bad example for automatic searching for all possible module
     variants:

$ strace -o foo python -c pass; grep open foo
...
open("/usr/lib/python23.zip/os.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT
open("/usr/lib/python23.zip/osmodule.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT
open("/usr/lib/python23.zip/os.py", O_RDONLY|O_LARGEFILE) = -1 ENOENT
open("/usr/lib/python23.zip/os.pyc", O_RDONLY|O_LARGEFILE) = -1 ENOENT
open("/usr/lib/python2.3/os.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT
open("/usr/lib/python2.3/osmodule.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT
open("/usr/lib/python2.3/os.py", O_RDONLY|O_LARGEFILE) = 4
open("/usr/lib/python2.3/os.pyc", O_RDONLY|O_LARGEFILE) = 5
...

Multiply that by the number of import statements and by the path length
(this installation has an extremely short default path of two elements).

Bye,
     Mike