lua-users home
lua-l archive

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

On Thu, 2004-11-04 at 09:43 -0800, Mark Hamburg wrote:
[snip concerns and comments]

I think the easiest way to answer the questions regarding my patch is to
simply say..

__methcall first, then __index, then the table itself

I.E. the idea was simply to (while remaining utterly
backward-compatible) offer a way to move the methods out of a directly
indexable mechanism.

> The big benefits of __methcall seem to be:
> * Easier support for safe userdata method invocation since methods can't be
> pulled off of one object and used on another. I could see a case for
> supporting __methcall just for userdata.

The only way this becomes safe is if you go with the

foo:bar(...)  ::= getmetatable(foo).__methcall(foo,"bar",...)

otherwise you can extract methods with

Personally I don't think it's a question of "hiding" or "making safe" --
I think it's far more a question partitioning the namespace a little

> * Separate namespaces for methods and attributes.

Indeed :-)


Daniel Silverstone               
PGP mail accepted and encouraged.            Key Id: 2BC8 4016 2068 7895