Documentation for method
freeze assembled from the following types:
Makes the value of the
Pair read-only, by removing it from its Scalar container, and returns it.
my = "apple";my = Pair.new('key', );.value = "orange"; # this works as expected.say; # OUTPUT: «key => orange␤».freeze.say; # OUTPUT: «orange␤».value = "a new apple"; # FailsCATCH ;# OUTPUT: «X::Assignment::RO: Cannot modify an immutable Str (apple)␤»
NOTE: this method is deprecated as of 6.d language version. Instead, create a new
Pair, with deconted key/value.
.=Map.=head.say; # OUTPUT: «orange␤»