Re: The case for transpiled generics
| From: | Levi Morrison via internals | Date: | Thu, 17 Sep 2020 19:25:30 +0000 |
| Subject: | Re: The case for transpiled generics | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111893@lists.php.net to get a copy of this message | ||
On Thu, Sep 17, 2020 at 1:00 PM Matthew Brown <matthewmatthew@gmail.com> wrote:
> > On Sep 17, 2020, at 1:28 PM, Brent Roose <brendt@stitcher.io> wrote:
> > But I don't want to get stuck on phrasing, if elidiing is the right term as Larry
> > suggests, let's go with it!
>
> No, the correct term is “type erasure”:
> https://en.m.wikipedia.org/wiki/Type_erasure
"type erasure" with respect to generics means that they are checked at
compile-time and erased at run-time. For instance, Java does generics
through type erasure, and you had better believe those get checked at
compile-time! This isn't what is being proposed, at least not how I
understood it.
Really these are just "hints", but historically in PHP the term "type
hints" meant actually type checks.
In summary:
- Checked at run-time (and probably also compile-time when possible):
reified generics.
- Checked only at compile-time and thrown away at run-time: erased generics..
- Not checked at all: ____?. Maybe we can call them "ignored generics"?