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.

```d
alias IntFunc = int delegate();

void main()
{
        int two() => 2;

        // automatically upgrades function pointers to delegates
        // which is exactly what we'd expect ...
        IntFunc[] explicit = [
                () => 1,
                () => two()
        ];

        void func(IntFunc[] arg) {
                // but in the case of a function,
                // our VERY EXPLICIT type parameter is seemingly ignored.
// there is no coercion/upgrading of function pointers to delegates
                //   at the call site, as with the variable.
                // BUT WHY?
                // what is the reasoning?
        }
}
```

Reply via email to