Re: [RFC] [Discussion] Bound-Erased Generic Types
| From: | Rowan Tommins [IMSoP] | Date: | Tue, 26 May 2026 13:12:54 +0000 |
| Subject: | Re: [RFC] [Discussion] Bound-Erased Generic Types | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131019@lists.php.net to get a copy of this message | ||
On 25 May 2026 20:26:41 BST, Matthew Brown <matthewmatthew@gmail.com> wrote:
>>
>> https://thephp.foundation/blog/2025/08/05/compile-generics/ is
>
>That blog post is a year old, and the top comment on the attached Reddit
>thread captures my view on it:
>
>> The problem with such an approach is that it locks generics to be
>reified.
I think the two proposals have a lot more overlap than their framing suggests. Both block us from
having completely erased generics, because they include *some* reification/monomorphization, but
nothing in Gina/Larry's blog post would actually block Seifeddine's proposal as far as I
can see.
Specifically, if you take everything Seifeddine has implemented, but 1) restrict generic
declarations to only interfaces and abstract classes; and 2) remove the "turbofish" syntax
completely; then you end up basically with what the blog post suggests.
The main difference of opinion is what to do with those "missing" parts:
- Larry & Gina proposed just leaving then forbidden until we decide how to implement them
- Seifeddine proposed locking in the syntax with some partial checking, but mostly just reflection
support
>In 2026 runtime-checked types don't make sense in all circumstances, not
>when static analysis tools can discover far more bugs, far earlier and
>faster, than runtime checks can ever hope to.
Elsewhere on this thread, I've put forward some thoughts about having a specific syntax
distinction between runtime-checked type information, and SA/reflection-only type information.
I'd be interested in your thoughts on that approach.
Rowan Tommins
[IMSoP]