# Pastebin 2ASZxhQo class ImmutableDS { has $!last-return; has $!field-value; has $.some-field is rw; method TWEAK(|) { $!some-field := Proxy.new: FETCH => method { my $tmp = $!last-return; $!last-return := Nil; $tmp // $!field-value }, STORE => method ($field-value) { $!last-return = self.new: :$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;