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


Here is a snippet from #perl6 on freenode:

<BenGoldberg> m: ('a', 42, 'b', 22/7, 'c', 23).first(Int|Rat, :kv).say
<+camelia> rakudo-moar 641ee1: OUTPUT«any((1 42), (3 3.142857))␤»

The result I expected was OUTPUT«(1 42)␤»

The docs say that the first argument for .first is Mu $matcher, and therefor 
autothreading should not happen.

Rakudo implements .first using a couple of internal helper methods, 
!first-accepts and !first-accepts-end, located here: 
https://github.com/rakudo/rakudo/blob/641ee1e/src/core/Any-iterable-methods.pm#L1185
 and
https://github.com/rakudo/rakudo/blob/641ee1e/src/core/Any-iterable-methods.pm#L1201

Both of these helpers have a first argument of $test, which is untyped, and is 
therefor of type Any.

Because of this, when either of these helper methods is called with a Junction, 
autothreading occurs.

So, if you could add a couple of Mu’s, I’d appreciate it.

Thanks, Ben Goldberg

Reply via email to