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 proposed for removal in future language versions and its use is not recommended.