Skip to content
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

∞.Rat ~~ Rat is False #5538

Closed
p6rt opened this issue Aug 6, 2016 · 3 comments
Closed

∞.Rat ~~ Rat is False #5538

p6rt opened this issue Aug 6, 2016 · 3 comments
Labels
LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented Aug 6, 2016

Migrated from rt.perl.org#128857 (status was 'resolved')

Searchable as RT128857$

@p6rt
Copy link
Author

p6rt commented Aug 6, 2016

From @zoffixznet

TimToady's comments on the matter​: http://irclog.perlgeek.de/perl6-dev/2016-08-06#i_12976358

I stumbled on this while examining https://rt-archive.perl.org/perl6/Ticket/Display.html?id=127341#ticket-history

It seems this commit had a consequence that .Rat on an Inf or NaN does not actually return an object that can be stored in a Rat​: rakudo/rakudo@498d0a4

The issue is now there's no guarantee that a .Rat can be used as a Rat and thus the programmer has to perform additional checks.

Here are some examples of the issue​:

<Zoffix> m​: say â��.Rat ~~ Rat
<camelia> rakudo-moar 589061​: OUTPUT«Falseâ�¤Â»
<Zoffix> m​: Duration.new​: NaN
<camelia> rakudo-moar 589061​: OUTPUT«Type check failed in assignment to $!tai; expected Rat but got Rational[Num,Int] (?)â�¤ in block <unit> at <tmp> line 1â�¤â�¤Â»
<Zoffix> m​: Duration.new​: â��
<camelia> rakudo-moar 589061​: OUTPUT«Type check failed in assignment to $!tai; expected Rat but got Rational[Num,Int] (?)â�¤ in block <unit> at <tmp> line 1â�¤â�¤Â»
<Zoffix> m​: class { has Rat $.secret-ingredient; method new ($v) { self.bless​: secret-ingredient => $v.Rat } }.new​: â��
<camelia> rakudo-moar 589061​: OUTPUT«Type check failed in assignment to $!secret-ingredient; expected Rat but got Rational[Num,Int] (?)â�¤ in method new at <tmp> line 1â�¤ in block <unit> at <tmp> line 1â�¤â�¤Â»
<Zoffix> m​: my Rat $x = â��.Rat
<camelia> rakudo-moar 589061​: OUTPUT«Type check failed in assignment to $x; expected Rat but got Rational[Num,Int] (?)â�¤ in block <unit> at <tmp> line 1â�¤â�¤Â»

--
Cheers,
ZZ | https://twitter.com/zoffix

@p6rt
Copy link
Author

p6rt commented Dec 30, 2017

From @zoffixznet

On Fri, 05 Aug 2016 20​:18​:01 -0700, cpan@​zoffix.com wrote​:

TimToady's comments on the matter​: http://irclog.perlgeek.de/perl6-
dev/2016-08-06#i_12976358

I stumbled on this while examining
https://rt-archive.perl.org/perl6/Ticket/Display.html?id=127341#ticket-history

It seems this commit had a consequence that .Rat on an Inf or NaN does
not actually return an object that can be stored in a Rat​:
rakudo/rakudo@498d0a4

The issue is now there's no guarantee that a .Rat can be used as a Rat
and thus the programmer has to perform additional checks.

Here are some examples of the issue​:

<Zoffix> m​: say â��.Rat ~~ Rat
<camelia> rakudo-moar 589061​: OUTPUT«Falseâ�¤Â»
<Zoffix> m​: Duration.new​: NaN
<camelia> rakudo-moar 589061​: OUTPUT«Type check failed in assignment
to $!tai; expected Rat but got Rational[Num,Int] (?)� in block <unit>
at <tmp> line 1��»
<Zoffix> m​: Duration.new​: â��
<camelia> rakudo-moar 589061​: OUTPUT«Type check failed in assignment
to $!tai; expected Rat but got Rational[Num,Int] (?)� in block <unit>
at <tmp> line 1��»
<Zoffix> m​: class { has Rat $.secret-ingredient; method new ($v) {
self.bless​: secret-ingredient => $v.Rat } }.new​: â��
<camelia> rakudo-moar 589061​: OUTPUT«Type check failed in assignment
to $!secret-ingredient; expected Rat but got Rational[Num,Int] (?)�
in method new at <tmp> line 1� in block <unit> at <tmp> line 1��»
<Zoffix> m​: my Rat $x = â��.Rat
<camelia> rakudo-moar 589061​: OUTPUT«Type check failed in assignment
to $x; expected Rat but got Rational[Num,Int] (?)� in block <unit> at
<tmp> line 1��»

Thank you for the report. This is now fixed.

Fix​: rakudo/rakudo@042cb7413f87277
Test​: Raku/roast@c3086244fd0c6feea

@p6rt
Copy link
Author

p6rt commented Dec 30, 2017

@zoffixznet - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Dec 30, 2017
@p6rt p6rt added the LTA Less Than Awesome; typically an error message that could be better label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

1 participant