lua-users home
lua-l archive

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


Thatcher Ulrich wrote:
> 
> On Apr 18, 2002 at 03:09 -0000, kaishaku13 wrote:
> > > It's essentially that sin is now called math.sin etc.
> >
> > And how will this discipline be implemented? metatables?
> > I assume this is the only way but want to make sure...
> 
> Just regular tables, I think -- no new features needed.  There's a Lua
> Technical Note that describes the convention.  See
> http://www.lua.org/notes/ltn007.html
> 
> The new 'globals' stuff provides some new ways to use a namespaced
> library, but is not required.

>From my Perl experience this document describes how to write the library
in Lua but doesn't provide much information on interfacing such a module
with the calling code.  Issues I would like to see would be

1) Versioning.  Saying something like, I need at least version 1.23 of
   the threads library.  If Lua loads anything older, then complain.

   The module could define a ModuleName.Version value that the import
   code would check against the requested version.

2) How to specify which library names are imported and where they go.  Perl
   lets you pick the public names you want.  For example, the POSIX
   module defines all the POSIX functions and constants on a particular
   system, but typically you don't want to pollute the namespace with all
   of these.

It appears to me that a standard "import" function needs to be defined that
does all these things.

Best,
Blair

-- 
Blair Zajac <blair@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/