# Pastebin TY9qyRud class OptionalObj {...} class Optional { has $.type; method __instanciate(Mu:U $type) { self.bless(:$type) } method new(*%h, *@a){ OptionalObj.new(:instance($.type.new(|%h, |@a))) }; method FALLBACK(Str $meth, *%h, *@a) { $.type.$meth(|%h, |@a) } method null() { OptionalObj.new(:instance(Nil)) } } class OptionalObj { has $.instance; method FALLBACK(Str $meth, *%h, *@a) { self but False } } multi sub postfix:(Mu:U $type) { Optional.__instanciate($type) } multi sub postfix:(OptionalObj $obj) { $obj.instance || $obj } class Point { has $.x; has $.y; } my $test = Point?.new(:x(42), :y(43)); if my $p = $test?.x { $p.say; } my $test2 = Set?.null; if my $q = $test2?.x { $q.say; }