[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is there any plan to include build-in class support?
- From: Lucas Zawacki <lfzawacki@...>
- Date: Wed, 12 Jan 2011 09:04:01 -0200
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 (http://lua-users.org/wiki/ObjectOrientationClosureApproach).
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 :)
--
http://www.twitter.com/lfzawacki
http://www.linesocode.wordpress.com