[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Encapsulation, table-protection, and packages
- From: Mark Hamburg <mhamburg@...>
- Date: Thu, 06 Jan 2005 10:46:17 -0800
Here is a rough proposal for a table-protection mechanism inspired in part
by the environment material in the 5.1 module system.
Add a metatable entry: __protected
If present, then all reads and writes of the table get checked and have to
be invoked from code with an environment equal to that specified by the
__protected field. If the code doesn't pass the protection test, then
__index or __newindex get invoked as appropriate. Method lookup bypasses the
Routines like table.insert could check their caller's environment.
Why would one want this? Primarily as a runtime check to confirm