lua-users home
lua-l archive

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


> The code you gave seems to work already. So why the proposal?

It works... but it does not protect the type against external tampering. Ie,
a piece of code can set any data to an arbitrary tag value (eg,
"settag(x,123)") which would then compromise the type's integrity.

Of course in practice, since an explicit "settag" is required, it is fairly
unlikely to happen accidently in a simple program.

Otoh, the opportunity exists here to implement *true abstract types* (ie,
ones that are externally seamless... completely hiding their internal
workings) by adding only a few lines of code and with almost no backward
compatibility problems.

And it also offers the opportunity to implement sensitive code in Lua
without compromising the host program's security.

*cheers*
Peter Hill