lua-users home
lua-l archive

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

André de Leiradella wrote:
I've done it myself, and I'm not happy. I've seen how others did it
themselves, and I'm still not happy. Unless I'm missing something, I
don't see a way to get rid of the self local that must prefix every
property of the "class", making me write self.this and self.that. I
don't see an elegant way to call inherited methods like
super.something(...) or inherited something(...), but only hacks like
self.super.something(self, ...) or SuperClassName.something(self, ...).

You can setfenv() the methods with a proxy table which looks
for globals first in the object's method+attribute table before
deferring to 'real' globals.

Personally I think that self.something() / self.super.something()
is clearer than 'something' implicitly coming out of the class's
namespace.  A standardised object mechanism isn't likely to address
such personal preferences.

Adam D. Moss   . ,,^^   co:3