lua-users home
lua-l archive

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


On Wed, Apr 27, 2011 at 2:29 PM, Lorenzo Donati
<lorenzodonatibz@interfree.it> wrote:
> - the actual object is stored in the proxy table using a "private" index
> (the metatable itself) to achieve encapsulation and prevent the client from
> tampering with the object directly.

as i understand it, encapsulation means having all relevant state
within the same object.  what you describe here is access control.

IMHO, encapsulation is great for clean code; access control is
overrated.  (note that Python doesn't have it and they claim it to be
a 'clean', 'readable', language)


> Note: I don't need inheritance support, since almost always use this pattern
> to represent objects of "concrete classes".

hurray!


-- 
Javier