On Mon, Mar 13, 2023, at 3:36 PM, Rowan Tommins wrote:
> On 13 March 2023 18:44:48 GMT, Robert Landers <landers.rob...@gmail.com> 
> wrote:
>>My approach was more of an iterative one.
>>
>>1. Get left-right done so that
>>
>>$x = something($left, $right, ...);
>>
>>would be allowed, but not
>>
>>$x = something($left, ..., $right);
>>
>>This would bring some immediate benefits, as initially proposed.
>
>
> There are three problems I see with that:
>
> 1) The choice of syntax for the first version immediately limits the 
> options for later additions, so you still need to discuss them. (IIRC, 
> the proposal that went to vote had separate ? and ... tokens, but a 
> number of different variations were experimented with.)
>
> 2) Most of the goals I mentioned above are not about the syntax, and 
> are no easier for left-to-right - for instance, copying the type 
> information for use in reflection and error messages.
>
> 3) Unlike purely or primarily functional languages, PHP's standard 
> library is not at all designed with parameter orders that lend 
> themselves to left-to-right application. I gave array_filter as an 
> example, because it's exactly the kind of function people will want to 
> use PFA for, but wouldn't be able to with left-to-right only.

Personally, I consider this the easiest thing to "let go of."  As has been 
discussed numerous times, all of the most used array functions need to be 
redesigned to work with iterables, and in many cases make more sense.  That 
would be a natural time to also revisit parameter order to fit with whatever 
partial application syntax was in use.

There are limitations to that (a left-to-right-only approach would then 
preclude optional arguments, which is not ideal), but "compatibility with the 
array functions written in 1996" is probably my least cared-about criteria.

That said, full support as the original RFC had would be ideal.  It's doing it 
in a clean and performant fashion that is the challenge.

--Larry Garfield

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

Reply via email to