> On May 14, 2021, at 4:18 PM, Mark Randall <marand...@php.net> wrote:
> 
> 
> Passing more arguments than the partial defines would result in an argument 
> count error.
> 

I think it’s reasonable to allow passing more arguments to a partial since 
user-defined functions and closures allow this without error.

Whether or not the extra arguments are automatically forwarded to the function 
wrapped by the partial is debatable.

Consider `function foo(int $x, int $y, int $z) {}` with a partial defined as 
`$partial = foo(?, 42)`.

If the partial is called as `$partial(73, 8)`, should 8 be forwarded to `$z` or 
should the call error as providing too few arguments? Or perhaps should the 
partial declaration should error, as it should have been `foo(?, 42, ?)` or 
`foo(?, 42, ...?) so the partial provided all required arguments to foo.

Cheers,
Aaron Piotrowski

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to