lua-users home
lua-l archive

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


Not for table entries. The point is that I want to build an object out of a
table and I would like a way to confirm that only the code implementing the
object actually touches the internals.

It doesn't provide much that careful conventions don't, but it provides a
potentially nice way to support runtime checking. It's also potentially
important when running code you don't control.

One alternative way to get encapsulation would be to export all protected
objects as proxies leading to their implementations. That, however, makes
the code implementing the objects more complicated and seems like it might
require per-object metatables for the proxies.

Mark

on 1/6/05 10:55 AM, Roberto Ierusalimschy at roberto@inf.puc-rio.br wrote:

>> Why would one want this? Primarily as a runtime check to confirm
>> encapsulation.
> 
> Isn't "local" enough for encapsulation?
> 
> -- Roberto