Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding constant constraints, refs #1464
  • Loading branch information
JJ committed Jul 3, 2018
1 parent 086ed92 commit 7255125
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/Type/Variable.pod6
Expand Up @@ -80,6 +80,14 @@ Sets the type constraint of a container bound to a variable.
CATCH { default { say .^name, ' ', .Str } }
# OUTPUT: «X::TypeCheck::Assignment Type check failed in assignment to $i; expected Int but got Str ("forty plus two")␤»
You can use any value defined in compile time as a type constraint, including
constants:
constant \T = Int;
my $i of T = 42;
which would be equivalent to the previous definition.
=head1 Methods
=head2 method name
Expand Down

0 comments on commit 7255125

Please sign in to comment.