Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
show anonymous subsets
  • Loading branch information
gfldex committed Sep 23, 2016
1 parent 10def9d commit 53f32fd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/Language/typesystem.pod6
Expand Up @@ -565,4 +565,15 @@ will be checked against the given code object.
CATCH { default { put .^name,': ', .Str } }
# OUTPUT«X::TypeCheck::Assignment: Type check failed in assignment to $i; expected Positive but got Int (-42)␤ …»
Subsets can be anonymous, allowing inline placements where a subset is required
but a name is either needed or desireable.
my enum E1 <A B>;
my enum E2 <C D>;
sub g(@a where { .all ~~ subset :: where * ~~ E1|E2 } ) {

This comment has been minimized.

Copy link
@zoffixznet

zoffixznet Sep 23, 2016

Contributor

where blocks already smartmatch, so * ~~ E1|E2 seems to make that fact less obvious. It can be written as just

 g(@a where .all ~~ subset :: where E1|E2 )
say @a
}
g([A, C]);
# OUTPUT«[A C]␤»
=end pod

0 comments on commit 53f32fd

Please sign in to comment.