id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,lang,patch,platform
562,"subclassing basic number types fails to inherit basic ops like add, sub, mul and div",bsdz,kjs,"When subclassing base types like Integer, Float and Complex. The ops sub, add, mul and div are not properly inherited by the derived class.

A basic example is provided by the following code: -

{{{
.sub '' :main
    $P0 = subclass 'Integer', 'FooInt'
    
    print 'Integer: 10 - 1 = '
    $P0 = new 'Integer'
    $P0 = 10
    sub $P1, $P0, 1
    say $P1
 
    print 'FooInt: 10 - 1 = '
    $P0 = new 'FooInt'
    $P0 = 10
    #$P1 = new 'FooInt' # uncommenting here does not help
    sub $P1, $P0, 1
    say $P1 
.end
}}}

outputs the following: -

{{{
Integer: 10 - 1 = 9
FooInt: 10 - 1 = Multiple Dispatch: No suitable candidate found for 'subtract_int', with signature 'PIP->P'
...
}}}

This appears to be related to RT http://rt.perl.org/rt3/Public/Bug/Display.html?id=59630 which outlines the problem for a specific case of a Complex type.

The attached script proves the bug also affects add, sub, mul, div for Integer, Float and Complex. It could be used as a test case.",bug,new,critical,,core,trunk,high,,pir subclass Integer Float Complex add mul div sub,,perl6,,all
