Re: [PHP-DEV] The case for transpiled generics

2020-09-18 Thread Rowan Tommins
On Thu, 17 Sep 2020 at 20:25, Levi Morrison via internals < internals@lists.php.net> wrote: > > 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

Re: [PHP-DEV] The case for transpiled generics

2020-09-17 Thread Brent Roose
Hi all To make myself clear, since I realise I used a confusing term in the subject of my mail. What I'm proposing is runtime-erased generics, the way Matthew describes them: PHP completely ignores them during runtime, and wouldn't do anything with them during compile time. It's up to third

Re: [PHP-DEV] The case for transpiled generics

2020-09-17 Thread Matthew Brown
I think the addition of runtime-erased generics would be a good thing for the language. I don’t think PHP should perform any sort of checking of generic parameters at compile time. No other equivalent interpreter performs those compile-time checks, and it’s also *very* complex — since adding

Re: [PHP-DEV] The case for transpiled generics

2020-09-17 Thread Matthew Brown
> On Sep 17, 2020, at 3:25 PM, Levi Morrison > wrote: > >  >> >> On Thu, Sep 17, 2020 at 1:00 PM Matthew Brown >> wrote: On Sep 17, 2020, at 1:28 PM, Brent Roose wrote: >>> But I don't want to get stuck on phrasing, if elidiing is the right term as >>> Larry suggests, let's go with

Re: [PHP-DEV] The case for transpiled generics

2020-09-17 Thread Levi Morrison via internals
On Thu, Sep 17, 2020 at 1:00 PM Matthew Brown wrote: > > On Sep 17, 2020, at 1:28 PM, Brent Roose 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”: >

Re: [PHP-DEV] The case for transpiled generics

2020-09-17 Thread Matthew Brown
> On Sep 17, 2020, at 1:28 PM, Brent Roose 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 Its opposite is called reification:

Re: [PHP-DEV] The case for transpiled generics

2020-09-17 Thread Brent Roose
Hi Ilija > On 17 Sep 2020, at 19:01, Ilija Tovilo wrote: > > Hi Brent > >> Today I'd like to hear your thoughts on what might be a controversial topic, >> though I think it's worth having this discussion. I want to make the case >> for adding generic syntax, without actually enforing any

Re: [PHP-DEV] The case for transpiled generics

2020-09-17 Thread Brent Roose
Hi Matthew and Larry > On 17 Sep 2020, at 18:21, Larry Garfield wrote: > > On Thu, Sep 17, 2020, at 10:21 AM, Matthew Brown wrote: >> Quick thing before I get into my own reaction: >> >> Transpiling is normally thought of as the process of converting one >> language into another. Tools like

Re: [PHP-DEV] The case for transpiled generics

2020-09-17 Thread Brent Roose
Hi George Thanks for the reply! > On 17 Sep 2020, at 14:34, G. P. B. wrote: > > Hello Brent, > > I'm going to make the argument I've already done on Reddit once [1], IMHO > TypeScript is just a nicer pipeline for a preprocessor and a static > analyser and not a language per say. > > Let me

Re: [PHP-DEV] The case for transpiled generics

2020-09-17 Thread Ilija Tovilo
Hi Brent > Today I'd like to hear your thoughts on what might be a controversial topic, > though I think it's worth having this discussion. I want to make the case for > adding generic syntax, without actually enforing any additional type checks > at runtime. Please hear me out. I think

Re: [PHP-DEV] The case for transpiled generics

2020-09-17 Thread Larry Garfield
On Thu, Sep 17, 2020, at 10:21 AM, Matthew Brown wrote: > Quick thing before I get into my own reaction: > > Transpiling is normally thought of as the process of converting one > language into another. Tools like Babel transpile TypeScript to JavaScript. > > What's being proposed here (AFAICT)

Re: [PHP-DEV] The case for transpiled generics

2020-09-17 Thread Matthew Brown
Quick thing before I get into my own reaction: Transpiling is normally thought of as the process of converting one language into another. Tools like Babel transpile TypeScript to JavaScript. What's being proposed here (AFAICT) is type erasure – the generic type information would be erased during

Re: [PHP-DEV] The case for transpiled generics

2020-09-17 Thread G. P. B.
On Thu, 17 Sep 2020 at 13:33, Brent Roose wrote: > Hello internals > > Today I'd like to hear your thoughts on what might be a controversial > topic, though I think it's worth having this discussion. I want to make the > case for adding generic syntax, without actually enforing any additional >

[PHP-DEV] The case for transpiled generics

2020-09-17 Thread Brent Roose
Hello internals Today I'd like to hear your thoughts on what might be a controversial topic, though I think it's worth having this discussion. I want to make the case for adding generic syntax, without actually enforing any additional type checks at runtime. Please hear me out. We've been