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.
1 parent 03dd1b5 commit ee43bb8Copy full SHA for ee43bb8
doc/Type/Pair.pod
@@ -127,4 +127,23 @@ Usage:
127
128
Returns a list of one C<Pair>, namely this one.
129
130
+=head2 method freeze
131
+
132
+Defined as:
133
134
+ method freeze(Pair:D:)
135
136
+Usage:
137
138
+ PAIR.freeze
139
140
+Makes the I<value> of the C<Pair> read-only, by removing it from its L<Scalar container|/language/containers#Scalar_containers>, and returns it.
141
142
+ my $str = "apple";
143
+ my $p = Pair.new('key', $str);
144
+ $p.value = "orange"; # this works as expected
145
+ $p.say; # key => orange
146
+ $p.freeze.say; # orange
147
+ $p.value = "a new apple"; # Fails with 'Cannot modify an immutable Str'
148
149
=end pod
0 commit comments