Ovid wrote:

The "intermediate class" solves the problem but it instantly suggests
that we have a new "design pattern" we have to remember.  Basically, if
I can't lexically scope the additional behavior a role offers, I
potentially need to remove the role or use the "intermediate class"
pattern.

my Dog $dog .= new;
my $junkyard = $dog but Guard;

You probably don't need to touch the class, but a particular object. You can lexically scope changes to an object using but and my quite easily. If you really need a modified class, then I think this would do it, but I'm not sure if it works:

my $junkyarddog = class is Dog does Guard {};
my ::($junkyarddog) $spot .= new;

Reply via email to