{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"milestone":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/d1588981e0248aaa0174906c99df180e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"d1588981e0248aaa0174906c99df180e","url":"https://api.github.com/users/petdance","login":"petdance","id":41100},"labels":[{"name":"bug","color":"1AA195","url":"https://api.github.com/repos/petdance/scratch/labels/bug"},{"name":"core","color":"DAA3CE","url":"https://api.github.com/repos/petdance/scratch/labels/core"},{"name":"Pri-critical","color":"2C0232","url":"https://api.github.com/repos/petdance/scratch/labels/Pri-critical"},{"name":"Sev-high","color":"0F6489","url":"https://api.github.com/repos/petdance/scratch/labels/Sev-high"}],"assignee":null,"updated_at":"2011-11-14T06:11:48Z","comments":0,"closed_at":null,"url":"https://api.github.com/repos/petdance/scratch/issues/562","body":"When subclassing base types like Integer, Float and Complex. The ops sub, add, mul and div are not properly inherited by the derived class.\nA basic example is provided by the following code: -\r\n\r\n```\r\n.sub '' :main\r\n    $P0 = subclass 'Integer', 'FooInt'\r\n    \r\n    print 'Integer: 10 - 1 = '\r\n    $P0 = new 'Integer'\r\n    $P0 = 10\r\n    sub $P1, $P0, 1\r\n    say $P1\r\n \r\n    print 'FooInt: 10 - 1 = '\r\n    $P0 = new 'FooInt'\r\n    $P0 = 10\r\n    #$P1 = new 'FooInt' # uncommenting here does not help\r\n    sub $P1, $P0, 1\r\n    say $P1 \r\n.end\r\n```\r\n\r\noutputs the following: -\r\n\r\n```\r\nInteger: 10 - 1 = 9\r\nFooInt: 10 - 1 = Multiple Dispatch: No suitable candidate found for 'subtract_int', with signature 'PIP->P'\r\n...\r\n```\r\n\r\nThis 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.\r\n\r\nThe attached script proves the bug also affects add, sub, mul, div for Integer, Float and Complex. It could be used as a test case.\r\n\r\nOriginally http://trac.parrot.org/parrot/ticket/562 by bsdz","html_url":"https://github.com/petdance/scratch/issues/562","number":562,"title":"subclassing basic number types fails to inherit basic ops like add, sub, mul and div","id":2226875,"created_at":"2011-11-14T06:11:48Z"},"action":"opened"}