lua-users home
lua-l archive

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


Roberto Ierusalimschy wrote:
>
> Here is a short description of these changes.

A lot of nice things :-)

>     - true and false are reserved words.

Looks like a real boolean type, not a "false" type.  I don't think
that's necessary but it's ok.

> We did not change the semantics of ":" (but see below).

See where? *g*

> - no more Setglobal/getglobal tag methods: instead, access to global
> variables uses "regular" gettable/settable over the global table.

Good.  How about a newindex method?  Called when a 'new' element is
stored into a table - old value was nil.  Would be the 'write'
counterpart of the index method.

> - no more tag methods for basic types: only tables and userdata can have
> a "handler-table". Moreover, "basic" tables and userdata (that is, those that
> you did not set a handler-table) cannot have tag methods, either.

Uh.  Why???  (And I was about to suggest adding more 'user defined'
operators like '^' *g*)

> - "easy inheritance": the tag methods for "gettable", "settable", and
> "index" can be a table, instead of a function. In that case, to "call"
> the tag method means to index that table. So, for A to inherit from B, we
> just set the "index" field in its handler-table to B; for instance
> 
>       metatable(A, {index=B})

Hmm... If you do this, then _please_ honour the function (call) tag
method of B and only do this redirection if it's not set!

"Calling" tables allows much more things then this simple redirection.

Ciao, ET.