Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UsefulClass {
- has $.a;
- has $.b;
- has $.c;
- method do-a { ... }
- method do-b { ... }
- method do-c { ... }
- # Str and Int can be converted to UsefulClass.
- multi method new (Str $s) { ... }
- multi method new (Int $s) { ... }
- }
- sub do-a-b-c (UsefulClass $cc) {
- $cc.do-a;
- $cc.do-b;
- $cc.do-c;
- }
- # I want to be able to write (1) instead of (2):
- do-a-b-c "string"; # (1)
- do-a-b-c UsefulClass.new("string"); # (2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement