lua-users home
lua-l archive

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


On Thu, 2004-11-04 at 10:26 -0800, Mark Hamburg wrote:
> > I think the easiest way to answer the questions regarding my patch is to
> > simply say..
> > __methcall first, then __index, then the table itself
> But what about entries in the table itself? Do those trump __methcall?

I said; completely clearly I think...

__methcall *first*
__index *second*
the table itself *last*

The patch itself makes this abundantly clear also

> > 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
> Protected metatables make this work. If the metatable is protected then,
> __methcall only gets invoked from OP_SELF and hence the function can't leak
> into the general environment. This means that userdata then doesn't need to
> type-test the first parameter on method calls if it exposes it's methods via
> __methcall in a protected metatable.

Indeed. But this doesn't need to be only for userdata. it can provide
protected types in Lua itself too.

D.

-- 
Daniel Silverstone                         http://www.digital-scurf.org/
PGP mail accepted and encouraged.            Key Id: 2BC8 4016 2068 7895