You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Tue, 06 Dec 2016 16:16:28 -0800, alex.jakimenko@gmail.com wrote:
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.
Migrated from rt.perl.org#130284 (status was 'open')
Searchable as RT130284$
The text was updated successfully, but these errors were encountered: