I've written about the recent #PHP #RFC to add bound erased generic types to PHP: https://gpb.moe/blog/opinion-bound-erased-generics.html

Not used to writing article, even less so articles clocking in at 2.3k words.

Opinion about the recent “Bound-Erased Generic Types” RFC

@Girgias I totally agree with the core argument of the article, but I don't think transpilation is an option.

If you were to use such a transpiled language you'd need to reinvent/augment lots of tooling _for each dialect_: language servers, PHP parsers, static analyzers, CS-fixers etc. and you can guarantee any particular variant will be abandonned in N years.

Transpilation is a "necessary" evil for JS and not having a transpilation/compilation step in PHP is one of the reasons I like it 😆

@dantleech any tool would need to be augmented if we had native syntax anyway. So I don't see how that's a blocker.

But if you are using static analysis you are having a "build" step anyway somewhere before you run your code for the first time.

@Girgias the difference is that toolls would be _updated_ for the official version of PHP vs. tools having to decide which transpilers to support. For SA you'd run it on the transpiled code, but you'd want to map the line numbers / positiions back to the "source" code. Basically it adds a _huge_ amount of complexity on the whole tooling stack.

@dantleech The transpiler I'm talking about would literally just be about converting a native syntax to do comments, nothing more.

Which if we add basic runtime generic type checks would means PHP-Parser would already have the syntax support.

@dantleech the whole point is that some people want both their cake and eat it. Because they want native syntax that does nothing, which wouldn't even mean you'd no longer need doc comments, and not need to have dedicated tooling that does so, instead pushing the language in a direction that affects millions of people which won't see any benefit and might even see it as detrimental.

If you so badly hate writing doc comments, then write and use the tool that allows you that.

@Girgias yeah, the argument that most people don't use SA is very convincing.

But I don't think a transpiler would gain traction unless it were an official project. For the very reason that you may as well just write doc comments and have first-class support for your code.