# New Ticket Created by  Patrick R. Michaud 
# Please include the string:  [perl #39081]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=39081 >


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

Reply via email to