# New Ticket Created by  Timothy Totten 
# Please include the string:  [perl #109500]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=109500 >


Some infix operators, including at least infix:<->, infix:«<» and
infix:<==> seem to fail to dispatch to user-defined versions outside
the setting.

An example:

class Foo {}
multi infix:<+> (Foo $a, Numeric $b) { say "Foo went up by $b"; }
multi infix:<-> (Foo $a, Numeric $b)  { say "Foo went down by $b"; }

my $foo = Foo.new;

$foo + 1;  ## Will output "Foo went up by 1", with no issues.

$foo - 1;   ## Fails with a fatal error, see below.

-------------

The subtraction get's dispatched to multi infix:<->(\$a, \$b) {
$a.Numeric - $b.Numeric } which is located in the core setting. It
dies with:

No applicable candidates found to dispatch to for 'Numeric'. Available
candidates are:␤:(Mu:U \$v, Mu %_!)␤␤  in method Numeric at
src/gen/CORE.setting:649␤  in sub infix:<-> at
src/gen/CORE.setting:2233

This indicates that the infix:<-> declared above is not being
dispatched to, even though it's more specific than the version from
the setting that is. Other infix operators including infix:<+> on the
other hand are working fine.

This is a very strange bug, and blocks DateTime::Math (and any other
libraries using the affected overridden operators) from being ported
to the newest Rakudo branch.

Reply via email to