[svn:parrot] r40294 - trunk/runtime/parrot/library
jonathan at svn.parrot.org
jonathan at svn.parrot.org
Mon Jul 27 21:56:23 UTC 2009
Author: jonathan
Date: Mon Jul 27 21:56:22 2009
New Revision: 40294
URL: https://trac.parrot.org/parrot/changeset/40294
Log:
[p6object] The ACCEPTS defined in proto-object was a bit liberal over what it accepted as matching the Any type, such that both Any ~~ Object and Object ~~ Any, which could tie Rakudo's multi-dispatcher in all kinds of knots when it tried to sort the candidates. This patch resolves this while also going to some effort to keep us interoperating with calls from other languages. We'll see how it flies.
Modified:
trunk/runtime/parrot/library/P6object.pir
Modified: trunk/runtime/parrot/library/P6object.pir
==============================================================================
--- trunk/runtime/parrot/library/P6object.pir Mon Jul 27 21:44:44 2009 (r40293)
+++ trunk/runtime/parrot/library/P6object.pir Mon Jul 27 21:56:22 2009 (r40294)
@@ -762,21 +762,25 @@
$P0 = self.'HOW'()
parrotclass = $P0.'get_parrotclass'(self)
+ # Perl6Object accepts anything.
$S0 = parrotclass
if $S0 == 'Perl6Object' goto accept_anyway
-
- $I0 = isa topic, 'Junction'
- if $I0 goto normal_check
-
- if $S0 == 'Any' goto accept_anyway
-
- normal_check:
+
+ # Otherwise, just try a normal check.
$I0 = can topic, 'HOW'
unless $I0 goto end
topicwhat = topic.'WHAT'()
$I0 = isa topicwhat, parrotclass
if $I0 goto end
$I0 = does topic, parrotclass
+ if $I0 goto end
+
+ # If this fails, and we want Any, and it's something form outside
+ # of the Perl 6 world, we'd best just accept it.
+ unless $S0 == 'Any' goto end
+ $I0 = isa topicwhat, 'Perl6Object'
+ unless $I0 goto accept_anyway
+ $I0 = 0
goto end
accept_anyway:
More information about the parrot-commits
mailing list