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


The .map method iterates through its input in a way that will be
prematurely terminated if the IterationEnd sentinel appears in the list.
Obviously this can adversely affect user code that uses .map directly.
But it also breaks some core code, including .perl and .gist on arrays:

$ ./perl6 -e 'my @a = 2,3,4; @a[1] := IterationEnd; say @a.elems; say @a.map({ 
"wibble" }).elems; say @a.perl; say @a.reverse.elems; say @a.reverse.perl'
3
1
[2]
3
[4]

Similar confusion also arises if the sentinel is ever generated in
.map's output:

$ ./perl6 -e 'my @a = 2,3,4; say @a.elems; say @a.map({ $_ == 3 ?? IterationEnd 
!! "wibble" }).elems'
3
1

-zefram

Reply via email to