Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make Rational a parametric role
hangs during setting compilation :(
  • Loading branch information
moritz committed Nov 20, 2011
1 parent 7e239ac commit 6853995
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/core/Rat.pm
@@ -1,4 +1,4 @@
my class Rat does Rational { }
my class Rat does Rational[Int, UInt64] { }
multi prefix:<->(Rat \$a) {
Rat.new(-$a.numerator, $a.denominator);
}
Expand Down
10 changes: 5 additions & 5 deletions src/core/Rational.pm
@@ -1,10 +1,10 @@
my role Rational is Real {
has Int $.numerator;
has Int $.denominator;
my role Rational[::NuT, ::DeT] is Real {
has NuT $.numerator;
has DeT $.denominator;

method new(Int \$nu = 0, Int \$de = 1) {
method new(NuT \$nu = 0, DeT \$de = 1) {
my $new := nqp::create(self);
my Int $gcd := $nu gcd $de;
my $gcd := $nu gcd $de;
my $numerator = $nu div $gcd;
my $denominator = $de div $gcd;
if $denominator < 0 {
Expand Down

0 comments on commit 6853995

Please sign in to comment.