We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 435be23 + 0eb8d39 commit e696e37Copy full SHA for e696e37
doc/Language/typesystem.pod6
@@ -846,6 +846,13 @@ will be checked against the given code object.
846
CATCH { default { put .^name,': ', .Str } }
847
# OUTPUT: «X::TypeCheck::Assignment: Type check failed in assignment to $i; expected Positive but got Int (-42)»
848
849
+Subsets can be used in signatures, e.g. by typing the output:
850
+ subset Foo of List where (Int,Str);
851
+ sub a($a, $b, --> Foo) { $a, $b }
852
+ # Only a List with the first element beint an Int and the second a Str will pass the type check.
853
+ a(1,"foo"); # passes
854
+ a("foo", 1); # fails
855
+
856
Subsets can be anonymous, allowing inline placements where a subset is required
857
but a name is neither needed nor desirable.
858
0 commit comments