Permalink
Browse files

narrow down more protos

  • Loading branch information...
moritz committed Oct 27, 2012
1 parent ce3b28d commit 0315558a151100ee75b6709a88c92b1a2f7025a9
Showing with 32 additions and 32 deletions.
  1. +2 −2 src/core/Any.pm
  2. +7 −7 src/core/Cool.pm
  3. +1 −1 src/core/Mu.pm
  4. +5 −5 src/core/Real.pm
  5. +14 −14 src/core/Stringy.pm
  6. +1 −1 src/core/control.pm
  7. +2 −2 src/core/operators.pm
View
@@ -260,11 +260,11 @@ multi infix:<===>($a, $b) {
nqp::p6bool(nqp::iseq_s(nqp::unbox_s($a.WHICH), nqp::unbox_s($b.WHICH)))
}
-proto infix:<before>(|) { * }
+proto infix:<before>($, $?) { * }
multi infix:<before>($x?) { Bool::True }
multi infix:<before>(\a, \b) { (a cmp b) < 0 }
-proto infix:<after>(|) { * }
+proto infix:<after>($, $?) { * }
multi infix:<after>($x?) { Bool::True }
multi infix:<after>(\a, \b) { (a cmp b) > 0 }
View
@@ -204,25 +204,25 @@ sub uc(Cool $s) { $s.uc }
sub ucfirst(Cool $s) is DEPRECATED { $s.ucfirst }
-proto sub rindex(|) { * };
+proto sub rindex($, $, $?) { * };
multi sub rindex(Cool $s, Cool $needle, Cool $pos) { $s.rindex($needle, $pos) };
multi sub rindex(Cool $s, Cool $needle) { $s.rindex($needle) };
-proto sub ords(|) { * }
+proto sub ords($) { * }
multi sub ords(Cool $s) { ords($s.Stringy) }
-proto sub comb(|) { * }
+proto sub comb($, $, $?) { * }
multi sub comb(Regex $matcher, Cool $input, $limit = *) { $input.comb($matcher, $limit) }
-proto sub capitalize(|) is DEPRECATED { * }
+proto sub capitalize($) is DEPRECATED { * }
multi sub capitalize(Str:D $x) {$x.capitalize }
multi sub capitalize(Cool $x) {$x.Stringy.capitalize }
-proto sub wordcase(|) { * }
+proto sub wordcase($) { * }
multi sub wordcase(Str:D $x) {$x.wordcase }
multi sub wordcase(Cool $x) {$x.Str.wordcase }
-proto sub tclc(|) { * }
+proto sub tclc($) { * }
multi sub tclc(Cool $x) { tclc $x.Str }
sub sprintf(Cool $format, *@args) {
@@ -240,7 +240,7 @@ sub split($pat, Cool $target, $limit = $Inf, :$all) {
$target.split($pat, $limit, :$all);
}
-proto sub chars(|) {*}
+proto sub chars($) {*}
multi sub chars(Cool $x) { $x.Str.chars }
multi sub chars(Str:D $x) { nqp::p6box_i(nqp::chars($x)) }
multi sub chars(str $x) returns int { nqp::chars($x) }
View
@@ -399,7 +399,7 @@ my class Mu {
}
-proto sub defined(|) { * }
+proto sub defined(Mu) { * }
multi sub defined(Mu \x) { x.defined }
proto sub infix:<~~>(|) { * }
View
@@ -85,7 +85,7 @@ my role Real does Numeric {
multi method Str(Real:D:) { self.Bridge.Str }
}
-proto sub cis(|) {*}
+proto sub cis($) {*}
multi sub cis(Real $a) { $a.cis }
multi infix:<+>(Real \a, Real \b) { a.Bridge + b.Bridge }
@@ -114,7 +114,7 @@ multi infix:«>=»(Real \a, Real \b) { a.Bridge >= b.Bridge }
multi prefix:<->(Real \a) { -a.Bridge }
-proto sub infix:<mod>(|) {*}
+proto sub infix:<mod>($, $) {*}
multi sub infix:<mod>(Real $a, Real $b) {
$a - ($a.Bridge.Int div $b.Bridge.Int) * $b;
}
@@ -123,17 +123,17 @@ multi sub abs(Real \a) {
a < 0 ?? -a !! a;
}
-proto sub truncate(|) {*}
+proto sub truncate($) {*}
multi sub truncate(Real:D $x) { $x.truncate }
multi sub truncate(Cool:D $x) { $x.Numeric.truncate }
-proto sub atan2(|) { * }
+proto sub atan2($, $?) { * }
multi sub atan2(Real \a, Real \b = 1e0) { a.Bridge.atan2(b.Bridge) }
# should really be (Cool, Cool), and then (Cool, Real) and (Real, Cool)
# candidates, but since Int both conforms to Cool and Real, we'd get lots
# of ambiguous dispatches. So just go with (Any, Any) for now.
multi sub atan2( \a, \b = 1e0) { a.Numeric.atan2(b.Numeric) }
-proto sub unpolar(|) {*}
+proto sub unpolar($, $) {*}
multi sub unpolar(Real $mag, Real $angle) { $mag.unpolar($angle) }
View
@@ -4,58 +4,58 @@ multi sub infix:<eqv>(Stringy:D $a, Stringy:D $b) {
$a.WHAT === $b.WHAT && ($a cmp $b) == 0
}
-proto prefix:<~>(|) { * }
+proto prefix:<~>($) { * }
multi prefix:<~>(\a) { a.Stringy }
-proto infix:<~>(|) { * }
+proto infix:<~>($?, $?) { * }
multi infix:<~>($x = '') { $x.Stringy }
multi infix:<~>(\a, \b) { a.Stringy ~ b.Stringy }
-proto infix:<x>(|) { * }
+proto infix:<x>($?, $?) { * }
multi infix:<x>() { fail "No zero-arg meaning for infix:<x>" }
multi infix:<x>($x) { $x.Stringy }
multi infix:<x>($s, $n) { $s.Stringy x ($n.Int // 0) }
-proto infix:<leg>(|) { * }
+proto infix:<leg>($?, $?) { * }
multi infix:<leg>(\a, \b) { a.Stringy cmp b.Stringy }
-proto infix:<eq>(|) { * }
+proto infix:<eq>($?, $?) { * }
multi infix:<eq>($x?) { Bool::True }
multi infix:<eq>(\a, \b) { a.Stringy eq b.Stringy }
-proto infix:<ne>(|) { * }
+proto infix:<ne>($?, $?) { * }
multi infix:<ne>($x?) { Bool::True }
multi infix:<ne>(Mu \a, Mu \b) { a !eq b }
-proto infix:<lt>(|) { * }
+proto infix:<lt>($?, $?) { * }
multi infix:<lt>($x?) { Bool::True }
multi infix:<lt>(\a, \b) { a.Stringy lt b.Stringy }
-proto infix:<le>(|) { * }
+proto infix:<le>($?, $?) { * }
multi infix:<le>($x?) { Bool::True }
multi infix:<le>(\a, \b) { a.Stringy le b.Stringy }
-proto infix:<gt>(|) { * }
+proto infix:<gt>($?, $?) { * }
multi infix:<gt>($x?) { Bool::True }
multi infix:<gt>(\a, \b) { a.Stringy gt b.Stringy }
-proto infix:<ge>(|) { * }
+proto infix:<ge>($?, $?) { * }
multi infix:<ge>($x?) { Bool::True }
multi infix:<ge>(\a, \b) { a.Stringy ge b.Stringy }
-proto infix:<~|>(|) { * }
+proto infix:<~|>($?, $?) { * }
multi infix:<~|>($x = '') { $x.Stringy }
multi infix:<~|>(\a, \b) { a.Stringy ~| b.Stringy }
-proto infix:<~^>(|) { * }
+proto infix:<~^>($?, $?) { * }
multi infix:<~^>($x = '') { $x.Stringy }
multi infix:<~^>(\a, \b) { a.Stringy ~^ b.Stringy }
-proto infix:<~&>(|) { * }
+proto infix:<~&>($?, $?) { * }
multi infix:<~&>() { fail "No zero-arg meaning for infix:<~&>" }
multi infix:<~&>($x) { $x.Stringy }
multi infix:<~&>(\a, \b) { a.Stringy ~& b.Stringy }
-proto prefix:<~^>(|) { * }
+proto prefix:<~^>($?, $?) { * }
multi prefix:<~^>(\a) { ~^ a.Stringy }
View
@@ -143,7 +143,7 @@ multi sub warn(*@msg) is hidden_from_backtrace {
0;
}
-proto sub eval(|) {*}
+proto sub eval($, *%) {*}
multi sub eval(Str $code, :$lang = 'perl6', PseudoStash :$context) {
my $eval_ctx := nqp::getattr(nqp::p6decont($context // CALLER::), PseudoStash, '$!ctx');
my $?FILES := 'eval_' ~ (state $no)++;
View
@@ -7,7 +7,7 @@ sub infix:<=>(Mu \a, Mu \b) is rw {
pir::perl6_container_store__0PP(a, b)
}
-proto infix:<does>(|) { * }
+proto infix:<does>(Mu, Mu, *%) { * }
multi infix:<does>(Mu:D \obj, Mu:U \rolish) is rw {
# XXX Mutability check.
my $role := rolish.HOW.archetypes.composable() ?? rolish !!
@@ -35,7 +35,7 @@ multi infix:<does>(Mu:U \obj, @roles) is rw {
X::Does::TypeObject.new().throw
}
-proto infix:<but>(|) { * }
+proto infix:<but>(Mu, Mu, *%) { * }
multi infix:<but>(Mu:D \obj, Mu:U \rolish) {
my $role := rolish.HOW.archetypes.composable() ?? rolish !!
rolish.HOW.archetypes.composalizable() ?? rolish.HOW.composalize(rolish) !!

0 comments on commit 0315558

Please sign in to comment.