> On 23 Sep 2015, at 23:06, Zefram (via RT) <[email protected]>
> wrote:
>
> # 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]
I think this is really a case of DIHWIDT. The IterationEnd sentinel needs to
be public, because module makers will need to be able to make their own
Iterators.
> 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
This is really equivalent to the use of last in:
$ ./perl6 -e 'my @a = 2,3,4; say @a.elems; say @a.map({ $_ == 3 ?? (last) !!
"wibble" }).elems'
3
1
which is both in perl 5 and perl 6 very acceptable usage.
IMHO, this ticket can be rejected.