On Thu, Apr 05, 2012 at 01:46:53PM -0700, Carl Mäsak wrote:
> <moritz> r: say ~(1, 2, 6 ... *)[10]
> <p6eval> rakudo 4373f0: OUTPUT«␤»
> <moritz> eeks
> <moritz> no, that particular thing isn't in RT
> * masak submits rakudobug

For the moment, I'm going to argue Rakudo's behavior here as 
"correct", or at least consistent with the spec.

The sequence (1, 2, 6 ... *)  produces a list with
four elements:  1, 2, 6, and a Failure object containing
"unable to deduce sequence".  This list is then asked for
its tenth element, which is Nil (because it's beyond the end
of the list), which is what is stringified and printed.

Since the Failure object is never used, its associated
exception is never thrown.

I suppose one could argue that a ... * sequence should produce
a non-terminating list of Failure objects; I may see if that
works out.

Along similar lines, the other "mostly eager" forms of trying 
to obtain the Failure end up not working because the "... *" part 
of the sequence signals "treat as potentially infinite at this
point", which pre-empts the mostly-eagerness.  

I agree that in most cases a mostly eager operation on a
infinite list should probably go ahead and reify a few terms
from the sequence first, rather than stopping immediately
(e.g. with '...') upon encountering it.  But I haven't found
a good bright-line rule for handling this in the general case,
nor do the Synopses have any good hints about it yet.

Pm

Reply via email to