On Sat, Sep 22, 2018 at 5:30 PM Larry Wall <la...@wall.org> wrote: > On Sat, Sep 22, 2018 at 11:40:13AM -0700, Joseph Brenner wrote: > : Sounds good, thanks. > > Well, yes, *sounds* good. :-) > > Monkey patching is allowed but discouraged in Perl 6, because Ruby. >
Mixed in roles: https://docs.perl6.org/language/objects#Mixins_of_roles may be helpful as well. You can add a role not just to a class, but to an instance of any other class. my $x = "something"; say $x.WHAT; role MyDebugRole { method mydebugthing { say "mydebugthing" } } $x does MyDebugRole; say $x.WHAT; $x.mydebugthing; (Str) (Str+{MyDebugRole}) mydebugthing $x will totally act like it used to, but anywhere you like, now you can call .mydebugthing() on it. Pretty cool. Curt