Re: First-class callable partial application
| From: | Larry Garfield | Date: | Fri, 10 Mar 2023 20:40:46 +0000 |
| Subject: | Re: First-class callable partial application | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119682@lists.php.net to get a copy of this message | ||
On Fri, Mar 10, 2023, at 2:16 PM, Eugene Sidelnyk wrote:
> I glanced over this RFC and suggested syntax has question marks. Each one
> stands for a single parameter.
>
> Since there are named arguments already, it seems to be redundant. We'd
> rather pass couple of named arguments and place the ... construction at the
> ending than twirl around with question marks in order to describe which
> parameters final closure will have.
>
> When we do PFA, what we think of is what we pass, not what would be
> necessary to pass afterwards.
>
> And yes, any feature should start from the smallest possible form. If we
> try to implement all at once, we would get nowhere.
(Please don't top-post.)
Named args were still very new at the time, so it wasn't clear the degree to which they should
be required. I still don't think only supporting named args is a good idea, as that creates
additional work for common cases.
Also, that wouldn't have changed the complexity part that people objected to. It was the
engine telling the difference at runtime between "foo($a, $b, $c)" and "foo($a, $b,
?)", which happens inside the C code for "call a function", that was the problem.
Named args wouldn't have mattered.
Sometimes features can start from small forms, but not always. Sometimes that just boxes you in and
makes it even harder to make the more complete version. Case in point,
readonly was
the junior version of asymmetric visibility, but was implemented too quickly without thinking
through all the implications, which then caused problems for actual asymmetric visibility's
implementation. That's one of the reasons asymmetric visibility didn't pass. So in that
case, the junior version prevented the full version from happening.
Anyway, until someone is able to commit time to coming up with a better implementation this is all
moot. :-)
--Larry Garfield