If a subclass doesn't define an "__init" method, then creating
a new instance of the subclass results in multiple calls to
the base class "__init" method.
I'm not sure if this is a real bug, or if the answer is
that "all class definitions must define an '__init'
method, even if that method is empty."
Here's a test program demonstrating the bug:
$ cat init2.pir
.sub main :main
$P0 = newclass 'Foo'
$P1 = subclass $P0, 'Bar'
$P2 = new 'Bar'
.end
.namespace [ 'Foo' ]
.sub '__init' :method
say "foo constructor"
.return ()
.end
$ ./parrot init2.pir
foo constructor
foo constructor
$
I've added a test for this to t/pmc/objects.t, feel free to
remove or otherwise adjust the test if this is in fact
correct behavior (and we should update the documentation if
this is the case).
Pm
> If a subclass doesn't define an "__init" method, then creating
> a new instance of the subclass results in multiple calls to
> the base class "__init" method.
Fixed, r12594. (__init was searched in parents with find_method, which
also searched parents ...)
> I've added a test for this to t/pmc/objects.t
Thanks, unTODOed.
> Pm
leo