Skip to content

Commit

Permalink
infixes that should likely be pure
Browse files Browse the repository at this point in the history
  • Loading branch information
TimToady committed Sep 27, 2015
1 parent 0132b65 commit 73836e1
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions src/core/List.pm
Original file line number Diff line number Diff line change
Expand Up @@ -894,13 +894,13 @@ my class List does Iterable does Positional { # declared in BOOTSTRAP
}

# The , operator produces a List.
proto infix:<,>(|) {*}
multi infix:<,>() {
proto sub infix:<,>(|) {*}
multi sub infix:<,>() {
my \result = List.CREATE;
nqp::bindattr(result, List, '$!reified', BEGIN IterationBuffer.CREATE);
result
}
multi infix:<,>(|) {
multi sub infix:<,>(|) {
my \result = List.CREATE;
my \in = nqp::p6argvmarray();
my \reified = IterationBuffer.CREATE;
Expand Down Expand Up @@ -978,7 +978,7 @@ multi sub infix:<cmp>(@a, @b) {
(@a Zcmp @b).first(&prefix:<?>) || @a <=> @b
}

proto sub infix:<X>(|) {*}
proto sub infix:<X>(|) is pure {*}
multi sub infix:<X>(+lol, :$with!) {
METAOP_CROSS($with, find-reducer-for-op($with))(|lol.list);
}
Expand Down Expand Up @@ -1095,7 +1095,7 @@ multi sub infix:<X>(+lol) {

my &cross = &infix:<X>;

proto sub infix:<Z>(|) {*}
proto sub infix:<Z>(|) is pure {*}
multi sub infix:<Z>(+lol, :$with!) {
METAOP_ZIP($with, find-reducer-for-op($with))(|lol.list);
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/Mu.pm
Original file line number Diff line number Diff line change
Expand Up @@ -666,13 +666,13 @@ multi sub infix:<~~>(Mu \topic, Mu \matcher) {
matcher.ACCEPTS(topic).Bool;
}

proto sub infix:<=:=>(Mu $?, Mu $?) { * }
proto sub infix:<=:=>(Mu $?, Mu $?) is pure { * }
multi sub infix:<=:=>($?) { Bool::True }
multi sub infix:<=:=>(Mu \a, Mu \b) {
nqp::p6bool(nqp::eqaddr(a, b));
}

proto sub infix:<eqv>(Any $?, Any $?) { * }
proto sub infix:<eqv>(Any $?, Any $?) is pure { * }
multi sub infix:<eqv>($?) { Bool::True }
multi sub infix:<eqv>(Any $a, Any $b) {
# Last ditch snapshot semantics. We shouldn't come here too often, so
Expand Down
2 changes: 1 addition & 1 deletion src/core/Order.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sub ORDER(int $i) {
$i == 0 ?? Same !! $i < 0 ?? Less !! More
}

proto sub infix:<cmp>(Mu $, Mu $) { * }
proto sub infix:<cmp>(Mu $, Mu $) is pure { * }
multi sub infix:<cmp>(\a, \b) {
return Order::Less if a === -Inf || b === Inf;
return Order::More if a === Inf || b === -Inf;
Expand Down
2 changes: 1 addition & 1 deletion src/core/Real.pm
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ multi sub prefix:<->(Real:D \a) { -a.Bridge }

# NOTE: According to the spec, infix:<mod> is "Not coercive,
# so fails on differing types." Thus no casts here.
proto sub infix:<mod>($, $) {*}
proto sub infix:<mod>($, $) is pure {*}
multi sub infix:<mod>(Real $a, Real $b) {
$a - ($a div $b) * $b;
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/Stringy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ multi sub prefix:<~>(num $a) { nqp::p6box_s($a) }

proto sub infix:<~>(|) is pure { * }
multi sub infix:<~>($x = '') { $x.Stringy }
multi sub infix:<~>(\a, \b) { a.Stringy ~ b.Stringy }
multi sub infix:<~>(\a, \b) { a.Stringy ~ b.Stringy }

proto sub infix:<x>(Mu $?, Mu $?) { * }
proto sub infix:<x>(Mu $?, Mu $?) is pure { * }
multi sub infix:<x>() { fail "No zero-arg meaning for infix:<x>" }
multi sub infix:<x>($x) { $x.Stringy }
multi sub infix:<x>($s, Num:D $n) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/operators.pm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ multi sub infix:<does>(Mu:U \obj, **@roles) is raw {
X::Does::TypeObject.new(type => obj).throw
}

proto sub infix:<but>(|) { * }
proto sub infix:<but>(|) is pure { * }
multi sub infix:<but>(Mu:D \obj, Mu:U \rolish) {
my $role := rolish.HOW.archetypes.composable() ?? rolish !!
rolish.HOW.archetypes.composalizable() ?? rolish.HOW.composalize(rolish) !!
Expand Down
16 changes: 8 additions & 8 deletions src/core/set_operators.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

proto sub infix:<(elem)>($, $ --> Bool) {*}
proto sub infix:<(elem)>($, $ --> Bool) is pure {*}
multi sub infix:<(elem)>($a, Any $b --> Bool) {
$a (elem) $b.Set(:view);
}
Expand All @@ -15,7 +15,7 @@ only sub infix:<∉>($a, $b --> Bool) {
$a !(elem) $b;
}

proto sub infix:<(cont)>($, $ --> Bool) {*}
proto sub infix:<(cont)>($, $ --> Bool) is pure {*}
multi sub infix:<(cont)>(Any $a, $b --> Bool) {
$a.Set(:view) (cont) $b;
}
Expand Down Expand Up @@ -152,7 +152,7 @@ only sub infix:<⊖>($a, $b --> Setty) {
# $a == $b and so $a.keys.all (elem) $b
# }

proto sub infix:<<(<=)>>($, $ --> Bool) {*}
proto sub infix:<<(<=)>>($, $ --> Bool) is pure {*}
multi sub infix:<<(<=)>>(Any $a, Any $b --> Bool) {
$a.Set(:view) (<=) $b.Set(:view);
}
Expand All @@ -168,7 +168,7 @@ only sub infix:<⊈>($a, $b --> Bool) {
$a !(<=) $b;
}

proto sub infix:<<(<)>>($, $ --> Bool) {*}
proto sub infix:<<(<)>>($, $ --> Bool) is pure {*}
multi sub infix:<<(<)>>(Any $a, Any $b --> Bool) {
$a.Set(:view) (<) $b.Set(:view);
}
Expand All @@ -184,7 +184,7 @@ only sub infix:<⊄>($a, $b --> Bool) {
$a !(<) $b;
}

proto sub infix:<<(>=)>>($, $ --> Bool) {*}
proto sub infix:<<(>=)>>($, $ --> Bool) is pure {*}
multi sub infix:<<(>=)>>(Any $a, Any $b --> Bool) {
$a.Set(:view) (>=) $b.Set(:view);
}
Expand All @@ -200,7 +200,7 @@ only sub infix:<⊉>($a, $b --> Bool) {
$a !(>=) $b;
}

proto sub infix:<<(>)>>($, $ --> Bool) {*}
proto sub infix:<<(>)>>($, $ --> Bool) is pure {*}
multi sub infix:<<(>)>>(Any $a, Any $b --> Bool) {
$a.Set(:view) (>) $b.Set(:view);
}
Expand Down Expand Up @@ -274,7 +274,7 @@ only sub infix:<⊎>(|p) {
infix:<(+)>(|p);
}

proto sub infix:<<(<+)>>($, $ --> Bool) {*}
proto sub infix:<<(<+)>>($, $ --> Bool) is pure {*}
multi sub infix:<<(<+)>>(Any $a, Any $b --> Bool) {
if nqp::istype($a, Mixy) or nqp::istype($b, Mixy) {
$a.Mix(:view) (<+) $b.Mix(:view);
Expand All @@ -293,7 +293,7 @@ only sub infix:<≼>($a, $b --> Bool) {
$a (<+) $b;
}

proto sub infix:<<(>+)>>($, $ --> Bool) {*}
proto sub infix:<<(>+)>>($, $ --> Bool) is pure {*}
multi sub infix:<<(>+)>>(Baggy $a, Baggy $b --> Bool) {
for $b.keys {
return False if $b{$_} > $a{$_};
Expand Down

0 comments on commit 73836e1

Please sign in to comment.