Re: [RFC] Partial function application

From: Date: Thu, 13 May 2021 17:00:05 +0000
Subject: Re: [RFC] Partial function application
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-114463@lists.php.net to get a copy of this message
On Tue, May 11, 2021, at 10:38 AM, Larry Garfield wrote:
> On Sun, Apr 25, 2021, at 2:25 PM, Larry Garfield wrote:
> > Greetings, Internalians!
> > 
> > I would like to offer for your consideration another RFC, specifically 
> > syntax for partial function application.
> > 
> > https://wiki.php.net/rfc/partial_function_application
> > 
> > It includes an implementation by Joe Watkins that is already about 95% 
> > complete.  (There's some edge cases he's still sorting out, but all of 
> > the typical cases should work already.)  Most of the design work comes 
> > from Levi Morrison and Paul Crovella.  I helped out with the tests, a 
> > few edge bits, and general instigator/nudge. :-)
> > 
> > Discuss.
> 
> It looks like the conversation has died down, and it's been two weeks, 
> so pending any other notable feedback I'll open a vote on this RFC on 
> Thursday or Friday.

Naturally there was more conversation. :-)  But good conversation, so the RFC has been updated
again.  I recommend everyone look it over another time.

Highlights:

* Joe was able to figure out how to fold the extra partial logic into the Closure object.  So the
Partial and ReflectionPartial classes are gone; partial application gives you a closure object that
looks like any other, but still manages to optimize away repeated partial application.

* Some descriptions were improved.

* Constructors already worked, with some caveats.  Joe managed to remove those caveats, so they now
work as you would expect them to.  (See the RFC section for details.)

* I included some references to other languages and how they handle partial application.  Short
version: This is the most robust and most fully featured version of any language I could find.  Rock
on, PHP! :-)

* Nicolas, I went ahead and made a test for partial-application-DI-autowiring, just to see what it
would look like.  It looks like this:

https://github.com/php/php-src/pull/6898/files#diff-218bb085c4cf4a35da35aa2d7a5cabd77f053d6f975340c2ef10de6f30dee503

Whether that's actually useful or not I don't know, but there it is. :-)

Since there were some substantive changes, we're pushing the vote start off until the first
half of next week, Monday/Tuesday timeframe.

Thanks for your feedback, everyone!

--Larry Garfield


Thread (68 messages)

« previous php.internals (#114463) next »