[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Cryptic OOP syntax
- From: Mark Hamburg <mhamburg@...>
- Date: Tue, 01 Feb 2005 18:06:38 -0800
on 2/1/05 3:26 PM, PA at petite.abeille@gmail.com wrote:
> Yes. I would venture that most mainstream ones do use 'super' in one
> form of another.
>
> I even use it myself :P
>
> http://alt.textdrive.com/lua/19/#c000013
> http://dev.alt.textdrive.com/file/lu/MyOtherClass.lua
>
> One er, rather, er, interesting aspect of this specific implementation
> is that you could 'skip' a hierarchy altogether:
>
> this.dwim = function()
> -- do additional stuff
>
> return this.super().super().dwim()
> end
>
> Note the 'super().super()' call. The same applies to both class and
> instance methods.
Unless you do really grotesque things with proxies and potentially incur
complexities at a number of other places, this doesn't work or becomes very
inefficient. Super is a property of the method in which it is being called
as much or more than it is a property of the target of the method.
On the other hand, if the mechanisms in C++ and Python are adequate then so
are the mechanisms in Lua as it exists right now.
Mark