Skip to content

Commit bb5256c

Browse files
committed
Provide insight about the method Pair.freeze when dealing with Scalar.
Close #1728
1 parent 2b7d497 commit bb5256c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/Type/Pair.pod6

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ $v = 'value B';
6262
$pair.say; # OUTPUT: a => value B
6363
=end code
6464
65+
It is possible to avoid such behaviour forcing the C<Pair> to remove the scalar container
66+
and to hold the effective value itself using the method L<freeze|/type/Pair#method_freeze>:
67+
68+
=begin code
69+
my $v = 'value B';
70+
my $pair = a => $v;
71+
$pair.freeze;
72+
$v = 'value C';
73+
$pair.say; # OUTPUT: a => value B
74+
=end code
75+
76+
6577
=head1 Methods
6678
6779
=head2 method new

0 commit comments

Comments
 (0)