Matt Diephouse wrote:
There's currently no way to call a superclass' method. I've just run
into this and leo suggested I sent a note to the list.
Here's what I want to do:
I have a ParrotClass (a class defined in PIR) that is derived from the
String class. I want to override it's set_string_native method to do
some processing before I store the value. My first attempt was this:
.sub __set_string_native method
.param string value
self = value
print "assign\n"
.end
While we haven't something like:
self.SUPER::__set_string_native(value)
... it's still possible to call super for some methods like the
__set_string_native, by extracting the first attribute:
.sub __set_string_native method
.param string s
$I0 = classoffset self, "MyClass"
$P0 = getattribute self, $I0
$P0 = s
.end
see also t/pmc/object-meths_30.pir (r8674)
The question ramains of course, why you should do that, as the inherited
method just does the same, that is - just don't declare
__set_string_native, *if* there isn't any difference in implementation.
leo