[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Need standard kernel supported class in Lua,
- From: "steve donovan" <steve.j.donovan@...>
- Date: Tue, 15 Jan 2008 14:51:42 +0200
I'd vote for that as the 'canonical' example.
People have different needs, and come from different backgrounds. Java
people tend to get confused and say 'where are the classes?' because
that's the Java doctrine. It's easy to say that they're just craving a
bit of syntactical sugar, but new people get worried about what they
perceive as a 'lack'.
The Gang of Three (long may they reign) are not going to include Lua
libraries in the standard distribution, but there _is_ a place for
interesting Lua code; the 'test' directory. So I'd vote for the
canonical example to go there! A simple wrapper function is easy to
write and would be very reassuring.
On the interoperability question, we all agree that obj:method() is
how you use an object, no matter how implemented. Things get a little
tricky with inheritance, because there are at least two main
approaches (a) an __index chain and (b) copy inherited methods into
current metatable. And that's assuming that it's been done using
metatables!
Either way, it would be very useful to have a convention, that however
implemented, you can find the class of an object with the field
__class and the base class of an object with the field __base. (I
recall David Manura pointing this out as an issue with general
exception-handling design in Lua).
That is, have a standard, minimal reflection interface and don't
mandate a particular implementation strategy.
steve d.
On Jan 15, 2008 1:28 PM, Robert Raschke <rrlua@tombob.com> wrote:
> How about we promote chapter 16 of PiL to be the "standard" OO model?
>
> And all the others are examples of other, equally valid, approaches.
> Ones that may be worth investigating if the "standard" doesn't quite
> fit what you want.
>
> Robby
>
>