I'm getting this error in some code:
Ambiguous call to 'new(Clutter::Stage: Clutter::Raw::Types::ClutterActor)'; these signatures all match:
:(Clutter::Actor: Clutter::Raw::Types::ClutterActor $actor, *%_)
:(Clutter::Stage: Mu $stage where { ... }, *%_)
Here is the offending signature from Clutter::Stage, which is a descendant of Clutter::Actor:
our subset StageAncestry is export of Mu
where ClutterStage | ActorAncestry;
...
class Clutter::Stage is Clutter::Actor {
...
multi method new (StageAncestry $stage) {
self.bless(:$stage);
}
}
And here is the conflicting part from Clutter::Actor:
our subset ActorAncestry is export of Mu
where ClutterAnimatable | ClutterContainer | ClutterScriptable | ClutterActor;
...
class Clutter::Actor {
...
multi method new (ClutterActor $actor) {
self.bless(:$actor);
}
Why isn't Clutter::Stage's new always selected over the method in Clutter::Actor?
Ah! The solution is to use
is default
to handle the ambiguity. The best part... it does follow the MRO. Consider:...and...
Thanks to timotimo in #perl6!