lua-users home
lua-l archive

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


That being said, I do sometimes wish that it were easier to distinguish
between an index access x.y and a method call x:m() in metamethods. That
would be a core change though not necessarily a syntax change.

The encapsulation code I posted today, for example, could benefit from that
knowledge. As it stands, it assumes encapsulated objects are only accessed
via method calls. 

Mark

on 1/26/05 6:41 PM, Mark Hamburg at mhamburg@adobe.com wrote:

> What do you mean by "putting OOP in the core"?
> 
> Lua already has the polymorphism aspect of OOP fairly well handled.
> 
> Inheritance is handled fairly cleanly in most of the OOP implementations for
> Lua so long as you don't want to make calls up the inheritance chain (i.e.,
> you don't care about super). Super calls can be handled just like in C++ and
> Python and those pass OOP muster with at least some people, so even this may
> be a non-issue.
> 
> Encapsulation is complicated to achieve. There are work arounds (I posted
> one to the Wiki this morning), but none of them are perfect. But
> encapsulation is arguably more about modularity than it is about OOP. For
> example, my ideal answer to encapsulation would probably be to introduce
> some form of private key declarations within modules together with ways to
> keep them private.
> 
> Mark
>