3 ms·
>Does that mean JavaScript should add no new syntax ever again? No, of course not. Yes? Yes. Maybe? At least not in cases where the language can already do th
by krapp 5y ago
>Does that mean JavaScript should add no new syntax ever again? No, of course not.
Yes? Yes. Maybe?
At least not in cases where the language can already do things adequately, and the change is just a cosmetic improvement. Annotating comments already works, changing that just to have a syntax that looks like type hinting but isn't just makes the language worse in my opinion. I'd rather they just bite the bullet and add optional type hinting, and make the syntax do what it appears to. Otherwise, the necessary complexity of typing Javascript should be kept entirely out of the language itself - including special syntax to make things easier. Deal with Typescript and its peculiarities and the build step, if that's what you want to do, and annotate types in the existing comment syntax, but Javascript is an untyped language and should be remain absolutely, even aggressively agnostic about such things.