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.

Some metatables will be needed to make i.e. the announced
f:read (instead of possible.  Where it becomes
interesting is how they make these 'methods' work on standard
types as these don't have metatables.  I.e.:


instead of

  str.find(s, "foo")

Ciao, ET.

PS: I would suggest longer names for the namespaces.  I.e.
'File' instead of 'io', 'String' instead of 'str' etc.
In Sol I decided that "namespace" names should use mixed
case letters starting with an upper case one (Number, String,
Table, Function, Userdata, Nil, File, Coroutine, ...).
When implemented properly, you don't have to type them that
often anyway.  I.e. you want to write t:append(e) instead
of Table.append(t,a) or x:sin() instead of Number.sin(x).