Skip to content

Instantly share code, notes, and snippets.

@RomanHargrave
Created March 21, 2021 05:08
Show Gist options
  • Save RomanHargrave/6afaea7a299c016811226eab4d6f78ec to your computer and use it in GitHub Desktop.
Save RomanHargrave/6afaea7a299c016811226eab4d6f78ec to your computer and use it in GitHub Desktop.
#!/usr/bin/env raku
class Bar {
has $.l = "left value";
has $.r = "right value";
multi method get(:$lhs) { $.l }
multi method get(:$rhs) { $.r }
method something(Int $depth = 0, |p) {
"this is a Bar of " ~ self.get(|p);
}
}
multi get(:$lhs) { "left" }
multi get(:$rhs) { "right" }
sub whatever(Int $depth = 0, |p) {
"whatever = " ~ get(|p);
}
say Bar.new.something(:lhs);
say Bar.new.something(:rhs);
say whatever(:lhs);
say whatever(:rhs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment