lua-users home
lua-l archive

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


On Thursday 28 December 2006 12:53 am, Jimmie Houchin wrote:
> Well, I basically am referencing comments about everyone rolling their
> own flavor of OOP in Lua. (SWIG thread)
> How important OOP is to Lua I cannot say. But for many it is their
> preferred programming paradigm. And since Lua does support OOP, there is
> no reason to not do it consistently and well. If I misread the roll your

for most people, OOP means encapsulation, polymorphism and inheritance.

the first two are so trivial to achieve that it's (IMNSHO) silly to try 
to 'standardise'.  rolling your own means only think that way when coding.

inheritance is the almost-missing piece, and here is where most people find 
themselves doing all kinds of kludges, and/or inefficiencies.

but, at the same time, most of these schemes are interoperable, just because 
of using the same syntax.

myself, i've found that sometimes it's nice to think in objects, but i've 
never (NEVER) found myself using inheritance when not using C++.  why? 
simple, because in dynamic languages the polymorphism is so much more 
flexible that it's not needed!

if two objects (i seldom use classes) are similar, just reuse the code.  no 
need to make them fit to a hierarchy, because in a functional language you 
can shuffle around methods, or easily setup some delegations, or 
even 'aspects' if you want.

that's why i hope there's never a 'blessed' OOP scheme in Lua.  just look at 
the mess that JS got!


-- 
Javier

Attachment: pgpPHMAY_8M0Z.pgp
Description: PGP signature