[perl #128857] [LTA] ∞.Rat ~~ Rat is False
On Fri, 05 Aug 2016 20:18:01 -0700, c...@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.perl.org/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: > https://github.com/rakudo/rakudo/commit/498d0a4ae4572a84f80c0c572632e12017d779f3 > > 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: > > m: say ∞.Rat ~~ Rat > rakudo-moar 589061: OUTPUT«False» > m: Duration.new: NaN > rakudo-moar 589061: OUTPUT«Type check failed in assignment > to $!tai; expected Rat but got Rational[Num,Int] (?) in block > at line 1» > m: Duration.new: ∞ > rakudo-moar 589061: OUTPUT«Type check failed in assignment > to $!tai; expected Rat but got Rational[Num,Int] (?) in block > at line 1» > m: class { has Rat $.secret-ingredient; method new ($v) { > self.bless: secret-ingredient => $v.Rat } }.new: ∞ > rakudo-moar 589061: OUTPUT«Type check failed in assignment > to $!secret-ingredient; expected Rat but got Rational[Num,Int] (?) > in method new at line 1 in block at line 1» > m: my Rat $x = ∞.Rat > rakudo-moar 589061: OUTPUT«Type check failed in assignment > to $x; expected Rat but got Rational[Num,Int] (?) in block at > line 1» Thank you for the report. This is now fixed. Fix: https://github.com/rakudo/rakudo/commit/042cb7413f87277 Test: https://github.com/perl6/roast/commit/c3086244fd0c6feea
[perl #128857] [LTA] ∞.Rat ~~ Rat is False
On Fri, 05 Aug 2016 20:18:01 -0700, c...@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.perl.org/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: > https://github.com/rakudo/rakudo/commit/498d0a4ae4572a84f80c0c572632e12017d779f3 > > 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: > > m: say ∞.Rat ~~ Rat > rakudo-moar 589061: OUTPUT«False» > m: Duration.new: NaN > rakudo-moar 589061: OUTPUT«Type check failed in assignment > to $!tai; expected Rat but got Rational[Num,Int] (?) in block > at line 1» > m: Duration.new: ∞ > rakudo-moar 589061: OUTPUT«Type check failed in assignment > to $!tai; expected Rat but got Rational[Num,Int] (?) in block > at line 1» > m: class { has Rat $.secret-ingredient; method new ($v) { > self.bless: secret-ingredient => $v.Rat } }.new: ∞ > rakudo-moar 589061: OUTPUT«Type check failed in assignment > to $!secret-ingredient; expected Rat but got Rational[Num,Int] (?) > in method new at line 1 in block at line 1» > m: my Rat $x = ∞.Rat > rakudo-moar 589061: OUTPUT«Type check failed in assignment > to $x; expected Rat but got Rational[Num,Int] (?) in block at > line 1» Thank you for the report. This is now fixed. Fix: https://github.com/rakudo/rakudo/commit/042cb7413f87277 Test: https://github.com/perl6/roast/commit/c3086244fd0c6feea
Re: [perl #128857] [LTA] ∞.Rat ~~ Rat is False
All of this was done to make Inf.Rat.Num roundtrip. I suggest thus that we make Inf.Rat fail, like we let Inf.Int fail. > On 06 Aug 2016, at 05:18, Zoffix Znet (via RT)> wrote: > > # New Ticket Created by Zoffix Znet > # Please include the string: [perl #128857] > # in the subject line of all future correspondence about this issue. > # https://rt.perl.org/Ticket/Display.html?id=128857 > > > > 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.perl.org/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: > https://github.com/rakudo/rakudo/commit/498d0a4ae4572a84f80c0c572632e12017d779f3 > > 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: > > m: say ∞.Rat ~~ Rat > rakudo-moar 589061: OUTPUT«False» > m: Duration.new: NaN > rakudo-moar 589061: OUTPUT«Type check failed in assignment to > $!tai; expected Rat but got Rational[Num,Int] (?) in block at > line 1» > m: Duration.new: ∞ > rakudo-moar 589061: OUTPUT«Type check failed in assignment to > $!tai; expected Rat but got Rational[Num,Int] (?) in block at > line 1» > m: class { has Rat $.secret-ingredient; method new ($v) { > self.bless: secret-ingredient => $v.Rat } }.new: ∞ > rakudo-moar 589061: OUTPUT«Type check failed in assignment to > $!secret-ingredient; expected Rat but got Rational[Num,Int] (?) in method > new at line 1 in block at line 1» > m: my Rat $x = ∞.Rat > rakudo-moar 589061: OUTPUT«Type check failed in assignment to $x; > expected Rat but got Rational[Num,Int] (?) in block at line > 1» > > > -- > Cheers, > ZZ | https://twitter.com/zoffix
[perl #128857] [LTA] ∞.Rat ~~ Rat is False
# New Ticket Created by Zoffix Znet # Please include the string: [perl #128857] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=128857 > 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.perl.org/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: https://github.com/rakudo/rakudo/commit/498d0a4ae4572a84f80c0c572632e12017d779f3 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: m: say ∞.Rat ~~ Rat rakudo-moar 589061: OUTPUT«False» m: Duration.new: NaN rakudo-moar 589061: OUTPUT«Type check failed in assignment to $!tai; expected Rat but got Rational[Num,Int] (?) in block at line 1» m: Duration.new: ∞ rakudo-moar 589061: OUTPUT«Type check failed in assignment to $!tai; expected Rat but got Rational[Num,Int] (?) in block at line 1» m: class { has Rat $.secret-ingredient; method new ($v) { self.bless: secret-ingredient => $v.Rat } }.new: ∞ rakudo-moar 589061: OUTPUT«Type check failed in assignment to $!secret-ingredient; expected Rat but got Rational[Num,Int] (?) in method new at line 1 in block at line 1» m: my Rat $x = ∞.Rat rakudo-moar 589061: OUTPUT«Type check failed in assignment to $x; expected Rat but got Rational[Num,Int] (?) in block at line 1» -- Cheers, ZZ | https://twitter.com/zoffix