JS types as comments

The "types as comments" proposal for JavaScript has been making the rounds lately and I'd like to put my opinion on record: I think this is a great idea.

I think types are a great feature to begin with—they help to obliterate a whole class of runtime bugs and speed up development with IDE hints. All well & good. But I think that part of the elegance of this proposal is that you can put anything in those new 'comment' spots. It doesn't have to be TypeScript, or Flow—it can be whatever you want. Because the compiler will treat it as a comment, it doesn't need to adhere to any existing syntax.

Beyond that, I like the admission that the gulf between the code that developers write and the code that gets executed is widening. JavaScript seems to stand apart from other languages in having such a rich ecosystem for transpiling; most other general-use languages in the same class as JS (PHP, Python, Go) don't transpile—probably as a result of control over the executing environment (that is, you can control the server where you run Go, but not the browser where you run JS).

But so anyway, I think this an excellent step towards closing that gulf, removing at least some of the need for transpilation steps (especially in the age of Interop 2022), and making things easier and faster for folks who work on the web.

Web Code

Next

iPhone SE

A couple of idle thoughts on the future of Apple's cheapest phone.

Previous

Big trux

Slate's article on the deadliness of big trucks is just the right level of incendiary journalism for me.