Re: [RFC] [Discussion] Bound-Erased Generic Types
| From: | Barel | Date: | Mon, 11 May 2026 18:08:20 +0000 |
| Subject: | Re: [RFC] [Discussion] Bound-Erased Generic Types | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130835@lists.php.net to get a copy of this message | ||
On Sun, 10 May 2026 at 21:04, Seifeddine Gmati <azjezz@carthage.software>
wrote:
> Hello Internals,
>
> I'd like to start the discussion on a new RFC adding bound-erased
> generics types to PHP.
>
> Generic type parameters can be declared on classes, interfaces,
> traits, functions, methods, closures, and arrow functions, with
> bounds, defaults, and variance markers. Type parameters erase to their
> bound at runtime; the pre-erasure form is preserved for Reflection and
> consumed by static analyzers.
>
> - RFC: https://wiki.php.net/rfc/bound_erased_generic_types
> - Implementation: https://github.com/php/php-src/pull/21969
>
> Thanks,
> Seifeddine.
>
Hi Seifeddine,
Many thanks for such a detailed and interesting proposal. There is one
thing that I have not seen specifically addressed in the RFC which is
performance.
What is the performance cost of this implementation for:
a) code that does not use Generics
b) code that uses Generics
If you could provide some data about this I think it would be a great
addition to the RFC
Cheers
Carlos