File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,20 @@ L<//|/language/operators#infix_//>,
53
53
L < with/without|/language/control#with,_orwith,_without > and
54
54
L < signatures|/type/Signature#Constraining_Defined_and_Undefined_Values > .
55
55
56
+ = head3 Coersion
57
+
58
+ Turning one type into another is done with coersion methods that have the same
59
+ name then the target type. This convention is made mandatory by
60
+ L < Signatures|/type/Signature#Coercion_Type > . The source type has to know how to
61
+ turn itself into the target type. To allow build-in types to turn themself into
62
+ user defined types use L < augment|/language/variables#The_augment_Declarator > .
63
+
64
+ Perl 6 provides methods defined in L < Cool|/type/Cool > to convert to a target
65
+ type before applying further operations. Most build-in types decend from
66
+ C < Cool > and as such may provide implicit coersion that may be undesired. It is
67
+ the responsibility of the user to care about trap-free usage of those
68
+ methods.
69
+
56
70
= head1 Type Declarators
57
71
58
72
Type declarators introduce a new type into the given scope. Nested scopes can
You can’t perform that action at this time.
0 commit comments