On Saturday, 26 September 2026 at 16:49:48 UTC, DanielG wrote:
I appreciate the reply, but that's not the question I am asking.

I am asking why there's a difference between an explicitly typed variable, and an explicitly typed function argument - both of which 'receive' the mixed-type array literal.

The compiler will implicitly upgrade the function pointers to delegates in one case, but not the other. What is the basis, or philosophy behind this policy?

Why do variable assignments receive this treatment, but not function arguments?

IMO this violates the Principle of Least Astonishment.

A function argument generally has to be given a type independent of which parameter type it'll end up matching, because overload resolution needs to compare each argument's own type against every candidate's parameter types to pick the best match — if argument inference depended on "the parameter type of whichever overload gets picked," that's circular. A variable declaration ( `IntFunc[] explicit = [...]` ) doesn't have this problem: there's exactly one destination type, known up front, so the compiler can safely bias the literal toward it.

Reply via email to