HaloO, John M. Dlugosz wrote:
Perl 6 has a concept of a "candidate list". The candidate list are those that could handle the call, typically inherited methods and multi variations.
"Candidate set" would be a better term. It is a subset of all long names of a multi in a lexical scope.
It seems that multi variations, at least with respect to the semicolon parameters, compare the actual type and drop out of the list if any don't match.
I'm not sure what you are asking. But if a candidate is applicable it competes with the other candidates for specificity. That is what the semicolons are for. And even if a candidate is voted out it still can vote out others.
What about ordinary methods (and ordinary parameters of multis)? Does the candidate list hold every method name that matches, or does it do simpler parameter matching based on number of arguments, required named arguments, etc.?
There is hopefully a complete specification what constitutes applicability. There can hardly be differing simpler versions. In other words there is only one subtype relation that is used whenever a binding takes place.
If that is the case, then a derived method might not hide a base class method if the parameter list is seriously incompatible.
That is a natural and welcome consequence of type based dispatch. Classes are for implementation sharing, not for transitive typing.
More interestingly, left-to-right ordering of multiply-inherited base classes will be checked for applicability rather than arbitrarily taking the leftmost.
Indeed, I would hope that order of inheritance doesn't matter. Regards, TSa. -- "The unavoidable price of reliability is simplicity" -- C.A.R. Hoare