lua-users home
lua-l archive

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


Just my 2 cent:

 - The API should be like that of loadfile: accept a string and return
   a function.  loadlib itself should only load the lib, not execute it.

 - It should perform some sanity checks like lua_undump (same Lua
   version; same number type; ...).

 - It should be possible to loadlib the same file multiple times.  Works
   with dl_open (has a ref-count).  The lib should assume that all
   loaded instances share the same static data/bss.

 - Unloading should be done by the GC.  It's easy to implement and
   requires only minimal support from the Lua core.

 - The same source file should be useable as a builtin library or as a
   dynamic library without any changes.  The build system should decide
   what to generate and the source file should adapt to that.

 - An API to access builtin libraries in the same way as dynamic ones.
   The best way would be that lua_loadfile (or a lua_load) handles all
   four cases:
    - Lua source file
    - Lua precompiled binary
    - Builtin C library
    - Dynamic C library
   That way the application does not have to care how some code has
   been implemented.  (not sure about the search order though...)

 - The currently included libraries (strlib, iolib, ...) should be
   converted to this scheme.

 - There should be a unique directory separator.  It would be ugly
   if one had to convert all
     require"lua/strings"
   to
     require"lua\\strings"
   and vice versa when moving some files to another system.  (I.e.
   like C, always use '/').

 - Similar for file name extensions.  If a dynamic loader requires
   a specific extensions (i.e. ".dll") the loader should append that
   by itself.

IMHO, creating such an infrastructure is much more important than the
actual implementation of the low level dynamic loader.  That seems to
be relatively easy on todays OSs...

Ciao, ET.