petdance/scratch — Issue #263: P6metaclass cannot derive from already-`register`ed PMC type
Author: petdance
Created: 2011-11-01 05:41:51+00:00
State: open
Labels: bug, library, Pri-major, Sev-medium

Registering a PMC-proxy seems to be enough to prevent its use as a parent class.
{{{
austin@andLinux:~/kakapo$ cat test.nqp
INIT {
P6metaclass.register('Hash');
}

class Foo is Hash {
INIT { say("Hello, Foo"); }
}
austin@andLinux:~/kakapo$ parrot-nqp test.nqp
Could not build C3 linearization: ambiguous hierarchy
current instr.: 'parrot;P6metaclass;register' pc 532 (runtime/parrot/library/P6object.pir:408)
called from Sub '' pc -1 ((unknown file):-1)
called from Sub 'parrot;PCT;HLLCompiler;evalpmc' pc 972 (compilers/pct/src/PCT/HLLCompiler.pir:538)
... call repeated 1 times
called from Sub 'parrot;PCT;HLLCompiler;compile' pc 388 (compilers/pct/src/PCT/HLLCompiler.pir:287)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 992 (compilers/pct/src/PCT/HLLCompiler.pir:556)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1303 (compilers/pct/src/PCT/HLLCompiler.pir:707)
called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1489 (compilers/pct/src/PCT/HLLCompiler.pir:794)
called from Sub 'parrot;NQP;Compiler;main' pc -1 ((unknown file):-1)
}}}

I suspect (based on scanning a trace, but not based on ''poring over'' the trace) that the problem lies in the `get_parrotclass` method.

The '''major''' impact for me is interoperation between the Kakapo library, which registers a large collection of PMC types, and the PCT/PGE tools, which build many of their classes as subtypes of Hash.

Originally http://trac.parrot.org/parrot/ticket/1520