lua-users home
lua-l archive

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

Steve Litt said:
> By the way, I really do like the closure way of doing methods, and would like
> to thank Lucas Zawacki for showing me how to do it in the "OOP Sortof" thread.

No need for thanks, all I did was read a little about closures and
this article (

On the efficiency side, you might notice that the two aproaches have a
tradeoff of memory and speed. The very same article has a little naive
benchmark showing this (and I think there was an email some time ago
commenting on this matter too)

steve donovan said:
> But it is _so_ entertaining writing Lua object models that everyone
> has done their own...just about all you can assume is that a method
> can be called obj:method(args).

There's a lot of truth in this. If we trust the method call to do the
right thing there's not a lot of places where changing the way objects
are implemented will break the code... but it may happen, exercise
caution with your abstractions :)