Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Shaped arrays with fractional sizes (my @a[0.5]) #4817
My previous bug report was about overflow associated with negative sizes
This time it is a little bit different:
Actually, it only accepts values that can unbox to a native integer. “0.5”
That being said, I think sometimes it could be useful to create an array if
Interestingly, it is not only about “-1” sneaking in:
Perhaps it should just round it down to an integer internally? … but why
<AlexDaniel> TimToady: “my @a[5.5]” – what should it mean? ,  or
Well, hmm… Go figure!
The first part of the ticket was resolved in rakudo/rakudo@46dca95
So you can no longer create an array using 0.5.
But you can still create an array with any fractional value that's larger than 1, and it will blow up later.
The commit mentioned above gives a clue on what part of the code can be changed to resolve the issue. https://github.com/rakudo/rakudo/blob/cef3bf3e75411a5a664f93ea72209637eaaf5e3d/src/core/Rakudo/Internals.pm#L357-L362
I *think* that calling .Int on it will resolve the issue, but this of course won't produce a Failure which was recommended by TimToady. Either way the issue should be easy to approach.
On 2015-12-03 19:32:19, firstname.lastname@example.org wrote: