New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
method rand (Range) fails to check type of $!max #5619
Comments
From @titsukiSee the following results. $ perl6 -e '("10"..15).rand.say' # min is Str Actually thrown at: $ perl6 -e '(10.."15").rand.say' # max is Str I think that the 2nd example should cause the error same as the 1st example. |
From @titsukiSorry, my Perl 6 version is $ perl6 --version On 2016-8月-26 金 19:23:02, cookbook_000@yahoo.co.jp wrote:
|
From @titsukiI've sent a pull request for this issue. On 2016-8月-26 金 19:23:02, cookbook_000@yahoo.co.jp wrote:
|
From @zoffixznetThe issue is due to there being a multi new [^1] that takes a Real min value and *coerces* the max value to a real. So in the case described in this ticket, it will coerce the Str max to Int, and by the time we get to .rand, both args are Ints. As suggested on IRC [^2], we can try removing that coercion and see if something explodes or not, but I'm unsure of the reasons that coercion is there. [^1] https://github.com/rakudo/rakudo/blob/aceb4af2/src/core/Range.pm#L51 |
1 similar comment
From @zoffixznetThe issue is due to there being a multi new [^1] that takes a Real min value and *coerces* the max value to a real. So in the case described in this ticket, it will coerce the Str max to Int, and by the time we get to .rand, both args are Ints. As suggested on IRC [^2], we can try removing that coercion and see if something explodes or not, but I'm unsure of the reasons that coercion is there. [^1] https://github.com/rakudo/rakudo/blob/aceb4af2/src/core/Range.pm#L51 |
Migrated from rt.perl.org#129100 (status was 'new')
Searchable as RT129100$
The text was updated successfully, but these errors were encountered: