You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/Language/traits.pod6
+11-4Lines changed: 11 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,8 @@ necessary unless you are effectively working with that interface.
46
46
47
47
The X<Uninstantiable representation trait> is not so much related to the
48
48
representation as related to what can be done with an specific class; it
49
-
effective prevents the creation of instances of the class via C<new>
49
+
effectively prevents the creation of instances of the class in any
50
+
possible way.
50
51
51
52
=begincode
52
53
constant @IMM = <Innie Minnie Moe>;
@@ -61,12 +62,18 @@ class don't-instantiate is repr('Uninstantiable') {
61
62
say don't-instantiate.imm for ^10;
62
63
=endcode
63
64
64
-
Uninstantiable classes can still be used via their class variables and methods, as above. However, trying to instantiate them this way: C<my $do-instantiate = don't-instantiate.new;> will yield the error C<You cannot create an instance of this type (don't-instantiate)>.
65
+
Uninstantiable classes can still be used via their class variables and
66
+
methods, as above. However, trying to instantiate them this way: C<my
67
+
$do-instantiate = don't-instantiate.new;> will yield the error C<You
68
+
cannot create an instance of this type (don't-instantiate)>.
65
69
66
70
=head2Traits and routines
67
71
68
-
Traits can be added to the definition of methods and routines to establish L<precedence|/functions#Precedence> and L<associativity|/language/functions#Associativity>. They act as a
69
-
L<sub defined using C<trait_mod>|/type/Sub#Traits> which take as argument the types and names of the traits that are going to be added.
72
+
Traits can be added to the definition of methods and routines to
73
+
establish L<precedence|/functions#Precedence> and
74
+
L<associativity|/language/functions#Associativity>. They act as a L<sub
75
+
defined using C<trait_mod>|/type/Sub#Traits> which take as argument the
76
+
types and names of the traits that are going to be added.
0 commit comments