[perl #40438] [BUG] Extending a dynpmc with a PIR method fails
Ron Schmidt via RT
parrotbug-followup at parrotcode.org
Mon Mar 9 01:53:07 UTC 2009
> In your example here, you're not using dynpmcs - you're using a PIR
> class as the base; The original sample code is old enough that it
> referred to the PerlString dynpmc which is no longer in core.
>
Well, the problem does seem to be related to PMCs rather than high level
classes. After a discussion with pmichaud on IRC the following problems
were identified:
(1) Methods declared in the 'parrot' HLL namespace are being installed
in PMCs declared in other HLL namespaces.
(2) Methods declared in the same non-parrot HLL as a PMC are not being
installed in that PMC.
The problems seem to be manifested in both built-in PMCs and Dynamic
PMCs, but are more relevant to Dynamic PMCs which seem much more likely
to use the hll modifier and be associated with an hll namespace.
My short example using high level classes in the example in my previous
posting somewhat refutes an earlier argument that "all classes are
defined in the 'parrot' HLL namespace, not the actual HLL namespace".
At least the example may do so for high level classes.
I have updated the previous test file,
t/dynpmc/subclass_with_pir_method.t, to reflect the removal of the
PerlString pmc and the current understanding of the problem. It now
relies on the rakudo Per6Str dynamic pmc which I view as less than ideal
for unit testing.
To remove the dependency on rakudo and include tests for built-in pmcs,
I have created a new test file, a test dynamic pmc, and a test built-in
pmc. The test suite also tries method access with a subclass of a PMC
that uses an hll directive because subclassing was used in the example
that originally opened the ticket. Subclassing does not seem to change
method access behavior through different hll namespaces and without
access to the PerlString pmc used to open the ticket it is hard for me
to tell to what extent it was relevant to the problem at the time.
If a pmc has an hll modifier in its pmclass declaration, a namespace
with the name of the pmc should be installed in the hll namespace and
not the parrot namespace. That conclusion seems a reasonable extension
of the description of the problem and was discussed on IRC without
noticeable dissent. The new test suite includes a test to verify the
inclusion of the pmclass class name in the appropriate hll namespace.
The test suite and pmcs should be attached ...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subclass_with_pir_method.patch
Type: text/x-patch
Size: 1908 bytes
Desc: not available
URL: <http://lists.parrot.org/pipermail/parrot-dev/attachments/20090308/3d5e4e80/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testhll.pmc
Type: application/octet-stream
Size: 955 bytes
Desc: not available
URL: <http://lists.parrot.org/pipermail/parrot-dev/attachments/20090308/3d5e4e80/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pmc_hll_namespace_dyn.t
Type: application/x-troff
Size: 4403 bytes
Desc: not available
URL: <http://lists.parrot.org/pipermail/parrot-dev/attachments/20090308/3d5e4e80/attachment-0001.t>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testhlld.pmc
Type: application/octet-stream
Size: 970 bytes
Desc: not available
URL: <http://lists.parrot.org/pipermail/parrot-dev/attachments/20090308/3d5e4e80/attachment-0003.obj>
More information about the parrot-dev
mailing list