On 12 June 2022 16:22:15 BST, Deleu <deleu...@gmail.com> wrote:
>> I honestly don't think this is how it will be perceived. If this syntax
>> is approved, people will see "fn" as the "new, better way" and
>> "function" as the "old, annoying way".
>>
>
>And to me that's not an argument to deny what people want.

I never said it was. I said that if that is what we expect, we should design 
the feature with that in mind, rather than relying on the older syntax as a 
crutch.



>  Given the current state in the world we're in, what can we 
> do to have a better DX on anonymous functions?

I already gave my answer to that: either add implicit capture as an opt-in to 
the current syntax; or add block scope and treat short closures as consistent 
with that.


>Honestly I don't think it was a mistake. It was designed more than a decade
>ago and there was no way of predicting the future. I've seen code written
>20~10 years ago and I've seen code written 5~0 years ago. I think the best
>decision was taken at the time it was taken and the world of development
>has changed enough for us to make different decisions now.

I've seen that argument before, but it's not clear to me that anything *has* 
changed. Anonymous functions are used for roughly the same things that always 
were, so why are the arguments made when they were added, and again when short 
closures were discussed previously, no longer valid?



>If someone decides to implement `function () use (*)` on a separate RFC, I
>would abstain from that because it's not something I'm interested in using

That's fair enough. Just remember that that is *your* opinion of what is 
important, and others may have different views.


>aesthetic issue caused by `use ()`, which is the only place in the language
>we use this construct.

That's like saying we only use the word "class" when declaring classes. It has 
slightly different syntax, but "use" is exactly the same principle as importing 
variables into scope with "global", or declaring them "static". It's entirely 
in keeping with how scope works in PHP.


>It seems to me that you agree that there is a chance the proposed syntax is
>going to be perceived as better and people will not want to use the old
>syntax anymore and that makes you not want to accept the RFC.

No, it makes me want to make the new syntax as useful as possible.


Regards,

-- 
Rowan Tommins
[IMSoP]

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

Reply via email to