lua-users home
lua-l archive

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


Hello,

Here is a revisited version of the fabled LUObject...

The only notable change is that now a class is fully defined as a function in the same way as the object itself is defined as a closure. In other words, an object is a set of nested closures. The outer closures define the class methods, the inner closures, the instance methods.

Systematically using closure for both class and instance, beside providing encapsulation, give a sense of "togetherness" to the implementation. Something which I was missing so far. Everything being equal, I kind of like it :)

Feedbacks, comments, criticism, opinions warmly welcome!

Cheers

--
PA, onnay equitursay
http://alt.textdrive.com/



Attachment: LUObject.lua
Description: Binary data

Attachment: MySubClass.lua
Description: Binary data

Attachment: MyOtherSubClass.lua
Description: Binary data