Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #40834] [BUG] - PMC methods aren't inherited to PIR subclasses

3 views
Skip to first unread message

Patrick R . Michaud

unread,
Nov 12, 2006, 10:54:49 AM11/12/06
to bugs-bi...@rt.perl.org
# New Ticket Created by Patrick R. Michaud
# Please include the string: [perl #40834]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=40834 >


If a METHOD is defined in a *.pmc file, that METHOD is not
automatically inherited by PIR-based subclasses.

$ cat zzz.pir
.sub main :main
$P0 = new 'String'
$P0 = 'Hello'
$P0.'replace'('e', 'a')
say $P0

$P99 = subclass 'String', 'Foo'

$P1 = new 'Foo'
$P1 = 'Hello'
$P1.'replace'('e', 'a')
say $P1

.end
$ ./parrot zzz.pir
Hallo
Segmentation fault
$
Pm

Leopold Toetsch

unread,
Nov 12, 2006, 11:29:54 AM11/12/06
to perl6-i...@perl.org, Patrick R.Michaud, bugs-bi...@rt.perl.org
Am Sonntag, 12. November 2006 16:54 schrieb Patrick R.Michaud:
> If a METHOD is defined in a *.pmc file, that METHOD is not
> automatically inherited by PIR-based subclasses.

This isn't quite true. But some METHODs / vtables / MMDs are implemented in a
way that doesn't cope with inheritance.

See also:
#39329: Check to make sure PMC_str_val, etc. are used appropriately

or:
src/pmc/integer.pmc:
...
PMC* add (PMC* value, PMC* dest) {
MMD_Integer: {
/*
* SELF and value can both be PMCs that inherit
* from Integer:
* cl = subclass "Integer", "MyInt"
* so we can't used PMC_int_val(SELF) in any of these
* Integer methods

leo

0 new messages