# Pastebin sHSXlm2x class ImmutableDS { has $!last-return; has $.field-value; has $.some-field is rw = Proxy.new: FETCH => method { my $tmp = $!last-return; $!last-return := Nil; $tmp // $!field-value }, STORE => method ($field-value) { $!last-return = self.clone: :$field-value } ; } my ImmutableDS $immutable-data-structure .= new: :42field-value; my $new-immutable-data-structure = $immutable-data-structure.some-field = 13; say $new-immutable-data-structure.some-field; say $immutable-data-structure.some-field;