lua-users home
lua-l archive

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


on 1/16/05 8:24 PM, Mark Hamburg at mhamburg@adobe.com wrote:

> Polymorphism
> -------------
> Lua does very well with respect to polymorphism. Given method lookup and
> __index and __newindex metamethods, one can implement the following
> interfaces in any number of ways and the client need never be any the wiser:
> 
>   obj:method( ... )
>   obj.field
>   obj.field = expression

Lua should perhaps receive some negative marks for the fact that its
primitive operators:

    pairs
    ipairs
    table.insert
    table.remove
    table.replace
    etc.

have no polymorphic support and this isn't really called out.

This is a place where generic functions might make sense.

Mark