Actually I don't think S03 says that '1,3,5 ... 8' should act as '1,3,5 ... *'

As I understand it '1,3,5 ... 8' gives an infinite list with all even numbers. 
'1,3,5 ... *' also gives an infinite list with all even numbers -- but this one 
is lazy.

So there is a difference in behaviour: When assigning to an array with 'my @odd 
= 1,3,5 ... 8;' all elements of the sequence have to be computed and smart 
matched agains '8'. This match never results in True and therefore we get a 
timeout, finally. In the other case ('my @odd = 1,3,5 ... *') "the sequence has 
no limit" (quote from S03) and the assignment can be lazy e.g. the values don't 
have to be computed and smart matched against something.

S03 explicitly notes:  

==== quote
If a limit is given, it must smartmatch exactly. If it does not, an infinite 
list results. For instance, since "asymptotically approaching" is not the same 
as "equals", both of the following are infinite lists, as if you'd specified * 
for the limit rather than 0:

    1,1/2,1/4 ... 0    # like 1,1/2,1/4 ... *
    1,-1/2,1/4 ... 0   # like 1,-1/2,1/4 ... *

Likewise, this is all of the even numbers:

    my $end = 7;
    0,2,4 ... $end

To catch such a situation, it is advised to write an inequality instead:

    0,2,4 ...^ { $_ > $end }
==== quote end

One note to the original command
> my @odd = 1,3,5 ... 8; say @odd[^4]

We can get around the assignment to @odd and thereby stay lazy:
> (1,3,5 ... 8)[^4]    ## works
1 3 5 7
> (1,3,5 ... *)[^4]    ## same as above
1 3 5 7

So IMHO this is not a bug (and the ticket could be closed).

Reply via email to