Function Signature Matcher (Method Dispatcher)

Problem Implement a method dispatcher: given a method name and a list of argument values, select the best-matching overload from a set of registered signatures, correctly handling variadic (variable-arity) parameters.

Requirements

  • Register overloads for a name, each with a typed parameter list (some may end in a variadic parameter).
  • dispatch(name, args) returns the single best-matching signature for the given arguments.
  • Support exact-type matches, widening / convertible matches, and variadic matches.

Areas to design

  • How to score a candidate signature against the actual arguments (exact > widening > variadic).
  • Arity checks and how a trailing variadic parameter absorbs surplus arguments.
  • Ambiguity resolution: what to do when two overloads score equally (reject as ambiguous vs a tie-break rule).
  • Edge cases: no viable candidate, zero arguments into a variadic, null / unknown argument types.
added …
LeaderboardSalaryAccount