On Fri, Aug 23, 2024 at 8:51 AM Roman Pronskiy
<roman.pronskiy@thephp.foundation> wrote:

>
> Do you consider the path of not adding generics to the core at all? In
> fact, this path is implicitly taken during the last years. So maybe it
> makes sense to enforce that status quo?
>
> Potential steps:
> - Make the current status quo official by recognizing generics PHPDoc
> syntax as The Generics for PHP. Just adding a php.net manual page will
> do.
> - Recognize Composer as the official PHP tool. It's currently not
> mentioned on php.net at all.
> - Suggest using PHPStan or Psalm for generics and type checks.
> - Add an official specification for generics in the PHP manual to
> eliminate semantic variances between tools.
>
> This will keep the core simple and reduce the maintenance burden, not
> increase it.
>
> Moreover, it does not contradict with any other implementation
> mentioned in the article, should they happen. In fact, it could be a
> first baby-step for any of them.
>
> There is also an attempt to do generics via attributes –
> https://github.com/php-static-analysis/attributes – it could
> potentially be a better alternative of recognising “official” syntax,
> because unlike PHPDocs, attributes can be available in core and the
> syntax is checked.
>
> What do you folks think?
>
> -Roman
>

Seems like a great plan, to be honest. I find it rather odd that Generics
is the most requested PHP feature because it seems like we have survived
without it for so long and I don't subscribe to the concept that this would
be the best thing for PHP since electricity.

Having an official "syntax" (Attributes, Docblock) could increase adoption.
On the other hand, I feel like a likely outcome is that folks will still
consider it as "something that doesn't exist yet" and will keep requesting
it.

Something else that is worth mentioning, I like that Collection is being
discussed as a small step as well. It's a very common use of Generics and
would be a great addition to the language if something solid comes out of
it.

-- 
Marco Deleu

Reply via email to