On Mon, Jun 28, 2021, at 9:52 AM, Nikita Popov wrote:

> These were just some notes on implementation details, they don't really
> impact my overall opinion of the RFC. I should also say that I'm not
> strongly opposed here, I'm just not convinced this is worthwhile :) The
> complexity of the feature would be rather easy to overlook if I felt the
> functionality was important.
> 
> I myself think one should take into account that this is a feature
> > that would make PHP stand out even more. Not being a follower of
> > other languages here :-)
> >
> 
> Heh, it's the other way around for me: This just makes me more
> apprehensive. Is there some special property of PHP that makes this feature
> more relevant to us than other languages? All other mainstream languages do
> well without this feature, so why do we need it?
> 
> Regards,
> Nikita

It depends what you mean by mainstream.

Ruby has a left-to-right-only version with an ugly syntax.

I just discovered there's a 3rd party macro for Rust that... looks an awful lot 
like this RFC:

https://docs.rs/partial_application/0.2.0/partial_application/

(I didn't spot it before because it's not part of the base language.)

I didn't think to look for R before, but apparently there's some kind of 
support there?  (I know nothing beyond what this page has.) 
https://purrr.tidyverse.org/reference/partial.html

Most functional languages have some version of it, although generally 
left-to-right only.  Which doesn't work when most of our standard lib was built 
without that in mind, so parameter order is not really convenient in most cases.

Javascript doesn't have it natively, but there are 3rd party libraries that try 
to do it.  Python is the same.  There are also existing 3rd party libraries to 
do partial application in PHP, but they're slow and clunky and no one markets 
them. :-)

Also, with only two exceptions (Rust and Go), most "mainstream" languages were 
developed long before the current trend of integrating functional features into 
more languages.  (Rust has some solid functional features.  Go actively avoids 
features as a design choice.)

So yes, this RFC would give PHP a more robust and flexible version of PFA than 
most other widely-used languages.  But that doesn't mean PFA is some obscure 
unknown feature that no one ever uses.  It's a valid feature that has been 
creeping into non-FP-centric languages slower than many would like, but it's 
hardly fringe.

--Larry Garfield

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

Reply via email to