On Thu, May 13, 2021 at 2:31 PM Sara Golemon <poll...@php.net> wrote: > > On Thu, May 13, 2021 at 2:31 PM Andreas Hennings <andr...@dqxtech.net> > wrote: > > > 1. Serializing: > > But outside of the above cases it should be technically possible, or not? > > > > > I suspect that the limitations you cite make any kind of general > serializing both unreliable and impractical. I wouldn't plan on meaningful > serialization. > > > > 2. var_export() > > > > > Same as above, really. > > > 3. Parameter switching > > > > Could we express the following as a partial function? > > > > static function ($a, $b) {return foo($b, $a);} > > > > E.g. as foo(?1, ?0) ? > > > > > Using named parameter we can: > > foo(b: ?, a: ?); > > -Sara
The current implementation doesn't support re-ordering anything. This feature has come up a few times. Personally, I don't think partials need to support this and every other potential feature; at some point a regular or short closure should be used. As a reminder, a `?` does not create a single argument in the closure's signature. All these `$partial`s are the same, and here I do not mean equivalent but literally the same: function f($x, $y) {} $partial = f(?); $partial = f(?, ?); $partial = f(?, ?, ?); $partial = f(?, ?, ?, ?); $partial = f(?, ?, ?, ?, ?); -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php