class Dot { has $.x; has $.y; has $!z; # Fancy syntax which simply sets each private variable. submethod BUILD(:$!x, :$!y, :$!z) { say "Initializing!"; } method get { return ($!x, $!y, $!z); } }; my $a = Dot.new(x => 23, y => 42, z => 2); say $_ for $a.get; #### # Blindly accept x and y, but do extra checks on z: submethod BUILD(:$!x, :$!y, :$z) { say "Initializing!"; die "z too big!" if $z > 10; $!z = $z; }