Skip Menu |
Report information
Id: 130284
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: alex.jakimenko [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Pre-Christmas-[REGRESSION]: roll with negative numbers no longer produces an empty sequence (42.roll(-1))
Download (untitled) / with headers
text/plain 541b
Code: say 42.roll(-1) Result (HEAD): (42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 ...) Result (2015.10): () Bisectable points to https://github.com/rakudo/rakudo/commit/f4e9d5e5074f3a34152ed472bf94b29679eb9692 IRC discussion: https://irclog.perlgeek.de/perl6/2016-12-06#i_13693983
Subject: [LTA] .pick with negative numbers talks about MVMArray ( 1.pick(-1) )
Download (untitled) / with headers
text/plain 220b
Code: say 1.pick(-1) Result: MVMArray: Index out of bounds in block <unit> at -e line 1 There's no “index” in my code, that's a number of elements. We probably want an error message that is not so low-level-ish.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 923b
On Tue, 06 Dec 2016 16:16:28 -0800, alex.jakimenko@gmail.com wrote: Show quoted text
> Code: > say 1.pick(-1) > > Result: > MVMArray: Index out of bounds > in block <unit> at -e line 1 > > > There's no “index” in my code, that's a number of elements. We > probably want an error message that is not so low-level-ish.
I've added an interim-fix[^1] to stop it crashing like that (and instead complain that it goes a non-UInt), but there doesn't yet seem to be a consensus[^2] on whether we should throw on negatives or treat them as zero (same applies to .roll). For example, `match` throws on negative :nth(), and so does `[][-1]`, but `42 xx -1` treats the negative as zero. So I'd like to examine more of these methods and routines to come up with some sort of consistency on what we do with out-of-bounds args. [1] https://github.com/rakudo/rakudo/commit/f367e4edc1 [2] https://irclog.perlgeek.de/perl6/2016-12-07#i_13698488


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org