Hi

On 4/4/24 23:27, Ilija Tovilo wrote:
I think it would be reasonable to consider deprecating passing extra
arguments to a non-variadic function.

IIRC one of the bigger downsides of this change are closure calls that
may provide arguments that the callee does not care about.

[…]

The user may currently choose to omit the $key parameter of the
closure, as it is never used. In the future, this would throw. We may
decide to create an exemption for such calls, but I'm not sure
replacing one inconsistency with another is a good choice.

I must admit, I find the

This RFC considers that anonymous functions are not intended to have a formal 
signature and should skip the exceeding argument count check.

bit of the previous RFC pretty reasonable to reduce the impact of the deprecation: I expect this type of callback to primarily be implemented as a single-use closure, which aren't really part of a package's API and thus relaxed checks are fine for those.

I also don't primarily see deprecating passing of superfluous parameters as removing an inconsistency. The more important bit for me is the improved error checking, i.e. I'd prefer to resolve the inconsistency in favor of the stricter checks, instead of relaxing the checks for internal functions. The previous RFC showcases multiple examples where it found bugs that likely were introduced during refactoring.

Best regards
Tim Düsterhus

Reply via email to