lua-users home
lua-l archive

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



On Jan 19, 2005, at 18:37, André de Leiradella wrote:

. Multiple constructors can be defined

Why have "constructors" in the first place? What about a class methods instead? E.g. anInstance = MyObject:class:new() or such.

Having super_of returning an iterator gives the programmer the choice of
having multiple inheritance or not, I do have in my class system to
mimic Java's interfaces.

What about forgetting about multiple inheritance all together and instead just allow for "behaviors" to be moved around (something along the lines of AOP)? So you could say something like: MyObject:class:addImplementation( anotherClass )?

You could as well support the equivalent of Objective-C categories by providing a function to adds methods to any classes as well: e.g. MyObject:class:addMethod( aMethod ).

. Methods must be called with ':'

Fine.

. Properties must be accessed with '.'

What about forgetting about properties altogether? After all, ivars are implementation details. There is no needs to expose them one way or another.

Is there another way of doing it? Seriously, maybe all objects should be
opaque, and getter/setter methods provided.

I like that better.

 But this will increase typing.

Then everything would be a method:

- Smalltalk: everything is an object.
- Objective-Lua: everything is a method.

. The syntax to call constructors

What about no constructor in the first place?

. The syntax to call inherited methods

What about something like: anInstance:super:doIt()?

. The repeated typing of 'self'

'self' is good. It should be a method as well. After all, OOP is about passing message around. There should always be an explicit target/action pair.

Cheers

--
PA
http://alt.textdrive.com/