HaloO,

Jonathan Worthington wrote:
Does the "veto" take place once the multiple dispatch has given us a candidate and we try to bind the parameters to the signature, or as part of the multiple dispatch? For example, supposing I declare:

multi foo(Int $a;; Num $b) { ... } # 1
multi foo(Int $a;; Str $b) { ... } # 2
multi foo(Int $a;; Num $b, Num $c) { ... } # 3

What happens with these?

I would expect that since all parameters are required that
they never show up in the same candidate set that is considered
by the dispatcher to find the most specific.


foo(2, RandomThing.new); # Ambiguous dispatch error

Assuming that the second parameter is incompatible to Num and Str
you should get a "can't dispatch" error---no ambiguity at all.

foo(2, 2.5); # Ambiguous dispatch error, or 1 because 2 vetos?

I must admit that I've never grasped that veto business. But why
should it be necessary here?

foo(1, 2.5, 3.4); # Ambiguous dispatch error, or 3 because only one with arity match?

Yeah, only #3 in the applicable method set.


Regards, TSa.
--

"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12  -- Srinivasa Ramanujan

Reply via email to