Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[S14] use :U instead of "where {!.defined}"
  • Loading branch information
moritz committed May 8, 2012
1 parent b57a05b commit 0079930
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions S14-roles-and-parametric-types.pod
Expand Up @@ -363,7 +363,7 @@ more multisubs into a property role like this:

role xxx {
has Int $.xxx;
multi trait_mod:<is>(::?CLASS $declarand where {!.defined}, :$xxx!) {...}
multi trait_mod:<is>(::?CLASS:U $declarand, :$xxx!) {...}
multi trait_mod:<is>(Any $declarand, :$xxx!) {...}
}

Expand All @@ -376,15 +376,15 @@ Since a class can function as a role when it comes to parameter type
matching, you can also say:

class MyBase {
multi trait_mod:<is>(MyBase $declarand where {!.defined}, MyBase $base) {...}
multi trait_mod:<is>(MyBase:U $declarand, MyBase $base) {...}
multi trait_mod:<is>(Any $declarand, MyBase $tied) {...}
}

These capture control if C<MyBase> wants to capture control of how it gets
used by any class or container. But usually you can just let it call
the generic defaults:

multi trait_mod:<is>($declarand where {!.defined}, $base) {...}
multi trait_mod:<is>(Any:U $declarand, $base) {...}

which adds C<$base> to the "isa" list of class C<$declarand>, or

Expand Down

0 comments on commit 0079930

Please sign in to comment.