On Mon, May 17, 2021, at 11:14 PM, Paul Crovella wrote: > On Fri, May 14, 2021 at 4:44 PM Aaron Piotrowski <aa...@trowski.com> wrote: > > > > My issue is the dual-meaning of ? in the current proposal. In `foo(?, 42)`, > > the ? represents a single argument, but adding a trailing ? (such as in > > `foo(?, 42, ?)`) represents any number of arguments. Would it perhaps make > > sense to make superfluous ? markers an error? > > > > foo(?); // Fine, needed to define a partial with no bound args. > > foo(?, 42); // Ok, binds second arg. > > foo(?, ?, 42); // Ok, binds third arg. > > foo(?, 42, ?); // Error, unnecessary placeholder. > > foo(?, ?); // Error, unnecessary placeholder. > > > > The intention here is to keep the syntax unambiguous. > > > > foo(?) == foo(?, ?) == foo(?, ?, ?) and so forth is not going to be obvious > > to everyone, so why allow meaningless and misleading syntax. > > > > Cheers, > > Aaron Piotrowski > > > > While it's my preference not to use superfluous placeholders they do > no real harm and I do not feel comfortable imposing this preference on > others.
User-space functions have always accepted more arguments than they're defined with. They just get dropped off the end silently, unless you use func_get_args() or variadics. While I know not everyone likes that "feature", it means that extra trailing ? "arguments" don't feel weird to me. They just get dropped off the end and we move on with life. At least that's how I conceptualize them. --Larry Garfield -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php