On Mon, 22 May 2017 05:20:25 -0700, [email protected] wrote:
> I'm not sure what proper behavior should be in this useless code below
> :)
> Probably something like in "say @t[*]" - constructing items until OOM
> - because Inf -1 = Inf.
>
> $ perl6 -e 'my @t := 1 .. *; say @t[*-1]'
> Cannot coerce Inf to an Int
> in block <unit> at -e line 1
>
> Actually thrown at:
> in block <unit> at -e line 1
>
>
> Also using two Whatevers on infinite list gives another cast error.
> IMO in this case exception should be thrown because Inf - Inf = NaN.
>
> $ perl6 -e 'my @t := 1 .. *; say @t[*-*]'
> Cannot coerce NaN to an Int
> in block <unit> at -e line 1
>
> Actually thrown at:
> in block <unit> at -e l
Thank you for the report. However, the errors reported are correct, as the
indexing operation coerces the final indices to Int:
dd <a b c>[1.2, ⅓ .. 1.5 ]
("b", ("a", "b"))
The @t[*] case you mention riefies all, hence the OOM, while the *-1 and *-*
are Inf-1 and Inf-Inf in your case, so the resultant indices are Inf and NaN,
and they cannot be coerced to Int.