[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RES: RES: Standard Object Reflection (was Re: OOP in daydream...)
- From: André de Leiradella <leiradella@...>
- Date: Thu, 20 Jan 2005 00:52:40 -0300
> on 1/19/05 9:02 AM, PA at email@example.com wrote:
>>> . The syntax to call inherited methods
>> What about something like: anInstance:super:doIt()?
> That would only work for one level of inheritance.
That depends on what super does inside its metamethods. It can search
for the method inside itself and, if not found, search recursively in
> Maybe the C++ approach of explicitly naming the parent class has some
> merit, though it also has maintenance issues. Those issues could be
> handle by defining a local variable named something like "super" at
> the beginning of a class declaration.
Not sure I'm following you here. This local variable "super" defined at
the beginning of a class solves the problem you described for C++,
> What gets more interesting is when one builds a multiple inheritance
> system that sequences the super classes. Then the next method (as
> opposed to the inherited method) depends on the over all chain. For
> example, given classes A and B as base classes for
> multiple-inheritance, it might be interesting to write:
> function A:method( param )
> call_next_method( self, A, "method", param )
> self.field = param
> One could also write an implementation for B that did appropriate
> chaining and get different results depending on whether one descended
> from A and B or B and A.
The order in which inherited methods are searched for will depend on the
implementations of particular class systems and changing it may break
Andre de Leiradella