Permalink
Browse files

Switch operators.pm to sigilless params

  • Loading branch information...
1 parent 018777f commit ddb2dd2b7470b4c71ab444a7e58b2d250d9ce446 @moritz moritz committed Aug 15, 2012
Showing with 66 additions and 66 deletions.
  1. +66 −66 src/core/operators.pm
View
@@ -3,49 +3,49 @@
## generic string operators are in Stringy.pm
## Int/Rat/Num operators are in {Int|Rat|Num}.pm
-sub infix:<=>(Mu \$a, Mu \$b) is rw {
- pir::perl6_container_store__0PP($a, $b)
+sub infix:<=>(Mu \a, Mu \b) is rw {
+ pir::perl6_container_store__0PP(a, b)
}
proto infix:<does>(|) { * }
-multi infix:<does>(Mu:D \$obj, Mu:U \$rolish) is rw {
+multi infix:<does>(Mu:D \obj, Mu:U \rolish) is rw {
# XXX Mutability check.
- my $role := $rolish.HOW.archetypes.composable() ?? $rolish !!
- $rolish.HOW.archetypes.composalizable() ?? $rolish.HOW.composalize($rolish) !!
- X::Mixin::NonComposable.new(:target($obj), :$rolish).throw;
- $obj.HOW.mixin($obj, $role).BUILD_LEAST_DERIVED({});
+ my $role := rolish.HOW.archetypes.composable() ?? rolish !!
+ rolish.HOW.archetypes.composalizable() ?? rolish.HOW.composalize(rolish) !!
+ X::Mixin::NonComposable.new(:target(obj), :rolish(rolish)).throw;
+ obj.HOW.mixin(obj, $role).BUILD_LEAST_DERIVED({});
}
-multi infix:<does>(Mu:D \$obj, Mu:U \$rolish, :$value! is parcel) is rw {
+multi infix:<does>(Mu:D \obj, Mu:U \rolish, :$value! is parcel) is rw {
# XXX Mutability check.
- my $role := $rolish.HOW.archetypes.composable() ?? $rolish !!
- $rolish.HOW.archetypes.composalizable() ?? $rolish.HOW.composalize($rolish) !!
- X::Mixin::NonComposable.new(:target($obj), :$rolish).throw;
+ my $role := rolish.HOW.archetypes.composable() ?? rolish !!
+ rolish.HOW.archetypes.composalizable() ?? rolish.HOW.composalize(rolish) !!
+ X::Mixin::NonComposable.new(:target(obj), :rolish(rolish)).throw;
my @attrs = $role.^attributes().grep: { .has_accessor };
X::Role::Initialization.new().throw unless @attrs == 1;
- $obj.HOW.mixin($obj, $role).BUILD_LEAST_DERIVED({ @attrs[0].Str.substr(2) => $value });
+ obj.HOW.mixin(obj, $role).BUILD_LEAST_DERIVED({ @attrs[0].Str.substr(2) => $value });
}
-multi infix:<does>(Mu:U \$obj, Mu:U \$role) is rw {
+multi infix:<does>(Mu:U \obj, Mu:U \role) is rw {
X::Does::TypeObject.new().throw
}
-multi infix:<does>(Mu:D \$obj, @roles) is rw {
+multi infix:<does>(Mu:D \obj, @roles) is rw {
# XXX Mutability check.
- $obj.HOW.mixin($obj, |@roles).BUILD_LEAST_DERIVED({});
+ obj.HOW.mixin(obj, |@roles).BUILD_LEAST_DERIVED({});
}
-multi infix:<does>(Mu:U \$obj, @roles) is rw {
+multi infix:<does>(Mu:U \obj, @roles) is rw {
X::Does::TypeObject.new().throw
}
proto infix:<but>(|) { * }
-multi infix:<but>(Mu:D \$obj, Mu:U \$rolish) {
- my $role := $rolish.HOW.archetypes.composable() ?? $rolish !!
- $rolish.HOW.archetypes.composalizable() ?? $rolish.HOW.composalize($rolish) !!
- X::Mixin::NonComposable.new(:target($obj), :$rolish).throw;
- $obj.HOW.mixin($obj.clone(), $role).BUILD_LEAST_DERIVED({});
+multi infix:<but>(Mu:D \obj, Mu:U \rolish) {
+ my $role := rolish.HOW.archetypes.composable() ?? rolish !!
+ rolish.HOW.archetypes.composalizable() ?? rolish.HOW.composalize(rolish) !!
+ X::Mixin::NonComposable.new(:target(obj), :rolish(rolish)).throw;
+ obj.HOW.mixin(obj.clone(), $role).BUILD_LEAST_DERIVED({});
}
-multi infix:<but>(Mu:D \$obj, Mu:U \$rolish, :$value! is parcel) {
- my $role := $rolish.HOW.archetypes.composable() ?? $rolish !!
- $rolish.HOW.archetypes.composalizable() ?? $rolish.HOW.composalize($rolish) !!
- X::Mixin::NonComposable.new(:target($obj), :$rolish).throw;
+multi infix:<but>(Mu:D \obj, Mu:U \rolish, :$value! is parcel) {
+ my $role := rolish.HOW.archetypes.composable() ?? rolish !!
+ rolish.HOW.archetypes.composalizable() ?? rolish.HOW.composalize(rolish) !!
+ X::Mixin::NonComposable.new(:target(obj), :rolish(rolish)).throw;
my @attrs = $role.^attributes().grep: { .has_accessor };
X::Role::Initialization.new.throw unless @attrs == 1;
my $mixin-value := $value;
@@ -54,29 +54,29 @@ multi infix:<but>(Mu:D \$obj, Mu:U \$rolish, :$value! is parcel) {
$mixin-value := @attrs[0].type.($value);
}
}
- $obj.HOW.mixin($obj.clone(), $role).BUILD_LEAST_DERIVED({ @attrs[0].Str.substr(2) => $mixin-value });
+ obj.HOW.mixin(obj.clone(), $role).BUILD_LEAST_DERIVED({ @attrs[0].Str.substr(2) => $mixin-value });
}
-multi infix:<but>(Mu:U \$obj, Mu:U \$rolish) {
- my $role := $rolish.HOW.archetypes.composable() ?? $rolish !!
- $rolish.HOW.archetypes.composalizable() ?? $rolish.HOW.composalize($rolish) !!
- X::Mixin::NonComposable.new(:target($obj), :$rolish).throw;
- $obj.HOW.mixin($obj, $role);
+multi infix:<but>(Mu:U \obj, Mu:U \rolish) {
+ my $role := rolish.HOW.archetypes.composable() ?? rolish !!
+ rolish.HOW.archetypes.composalizable() ?? rolish.HOW.composalize(rolish) !!
+ X::Mixin::NonComposable.new(:target(obj), :rolish(rolish)).throw;
+ obj.HOW.mixin(obj, $role);
}
-multi infix:<but>(Mu \$obj, Mu:D $val) is rw {
+multi infix:<but>(Mu \obj, Mu:D $val) is rw {
my $role := Metamodel::ParametricRoleHOW.new_type();
my $meth := method () { $val };
$meth.set_name($val.^name);
$role.HOW.add_method($role, $meth.name, $meth);
$role.HOW.set_body_block($role,
- -> |$c { nqp::list($role, nqp::hash('$?CLASS', $c<$?CLASS>)) });
+ -> |c { nqp::list($role, nqp::hash('$?CLASS', c<$?CLASS>)) });
$role.HOW.compose($role);
- $obj.HOW.mixin($obj.clone(), $role);
+ obj.HOW.mixin(obj.clone(), $role);
}
-multi infix:<but>(Mu:D \$obj, @roles) {
- $obj.HOW.mixin($obj.clone(), |@roles).BUILD_LEAST_DERIVED({});
+multi infix:<but>(Mu:D \obj, @roles) {
+ obj.HOW.mixin(obj.clone(), |@roles).BUILD_LEAST_DERIVED({});
}
-multi infix:<but>(Mu:U \$obj, @roles) {
- $obj.HOW.mixin($obj, |@roles)
+multi infix:<but>(Mu:U \obj, @roles) {
+ obj.HOW.mixin(obj, |@roles)
}
sub SEQUENCE($left, $right, :$exclude_end) {
@@ -173,8 +173,8 @@ sub SEQUENCE($left, $right, :$exclude_end) {
}
# XXX Wants to be a macro when we have them.
-sub WHAT(\$x) {
- $x.WHAT
+sub WHAT(\x) {
+ x.WHAT
}
proto sub infix:<...>(|) { * }
@@ -183,59 +183,59 @@ multi sub infix:<...>($a, $b) { SEQUENCE($a, $b) }
proto sub infix:<...^>(|) { * }
multi sub infix:<...^>($a, $b) { SEQUENCE($a, $b, :exclude_end(1)) }
-sub undefine(Mu \$x) {
+sub undefine(Mu \x) {
my $undefined;
- $x = $undefined;
+ x = $undefined;
}
-sub prefix:<temp>(\$cont) is rw {
+sub prefix:<temp>(\cont) is rw {
my $temp_restore := pir::find_caller_lex__Ps('!TEMP-RESTORE');
my int $i = nqp::elems($temp_restore);
while $i > 0 {
$i = $i - 2;
- return-rw $cont if nqp::atpos($temp_restore, $i) =:= $cont;
+ return-rw cont if nqp::atpos($temp_restore, $i) =:= cont;
}
- if nqp::iscont($cont) {
- nqp::push($temp_restore, $cont);
- nqp::push($temp_restore, nqp::p6decont($cont));
+ if nqp::iscont(cont) {
+ nqp::push($temp_restore, cont);
+ nqp::push($temp_restore, nqp::p6decont(cont));
}
- elsif nqp::istype($cont, Array) {
- nqp::push($temp_restore, $cont);
- nqp::push($temp_restore, my @a = $cont);
+ elsif nqp::istype(cont, Array) {
+ nqp::push($temp_restore, cont);
+ nqp::push($temp_restore, my @a = cont);
}
- elsif nqp::istype($cont, Hash) {
- nqp::push($temp_restore, $cont);
- nqp::push($temp_restore, my %h = $cont);
+ elsif nqp::istype(cont, Hash) {
+ nqp::push($temp_restore, cont);
+ nqp::push($temp_restore, my %h = cont);
}
else {
X::Localizer::NoContainer.new(localizer => 'temp').throw;
}
- $cont
+ cont
}
-sub prefix:<let>(\$cont) is rw {
+sub prefix:<let>(\cont) is rw {
my $let_restore := pir::find_caller_lex__Ps('!LET-RESTORE');
my int $i = nqp::elems($let_restore);
while $i > 0 {
$i = $i - 2;
- return-rw $cont if nqp::atpos($let_restore, $i) =:= $cont;
+ return-rw cont if nqp::atpos($let_restore, $i) =:= cont;
}
- if nqp::iscont($cont) {
- nqp::push($let_restore, $cont);
- nqp::push($let_restore, nqp::p6decont($cont));
+ if nqp::iscont(cont) {
+ nqp::push($let_restore, cont);
+ nqp::push($let_restore, nqp::p6decont(cont));
}
- elsif nqp::istype($cont, Array) {
- nqp::push($let_restore, $cont);
- nqp::push($let_restore, my @a = $cont);
+ elsif nqp::istype(cont, Array) {
+ nqp::push($let_restore, cont);
+ nqp::push($let_restore, my @a = cont);
}
- elsif nqp::istype($cont, Hash) {
- nqp::push($let_restore, $cont);
- nqp::push($let_restore, my %h = $cont);
+ elsif nqp::istype(cont, Hash) {
+ nqp::push($let_restore, cont);
+ nqp::push($let_restore, my %h = cont);
}
else {
X::Localizer::NoContainer.new(localizer => 'let').throw;
}
- $cont
+ cont
}
# not sure where this should go

0 comments on commit ddb2dd2

Please sign in to comment.