5 ms·
I love TypeScript and use it in any new project I create. The author is right though, you need to have team discipline to avoid using the `any` type when it ca
by cetra3 8y ago
I love TypeScript and use it in any new project I create. The author is right though, you need to have team discipline to avoid using the `any` type when it can be avoided, and immutability is not in scope.
TypeScript is probably the closest we'll get to my personal ideal of static typing in JS, while understanding that you sometimes need an escape hatch to deal with dynamic typing as JS is a dynamic language.
I think that the focus now should be allowing other more modern languages in the browser by means of Web Assembly. Rust is a great candidate for dealing with immutability and unsoundness concerns. I can't wait for wasm to be fleshed out more.
It does beg the question though, would web development be as ubiquitous and as popular if the core language in was statically typed? Does the freedom JS offer you allow greater adoption overall, meaning that it's beneficial to loosen the type restriction as the ecosystem will flourish because of it?
- ritchiey 8y agoYou don’t need to wait for web-assembly to solve these problems. TA mentions 3 languages (Elm, Reason & Purescript) that combine sound type-checking and immutability right now. None of these bring the cognitive overhead of Rust’s borrow checker and, in the case of Reason at least, compile at lightning speed to readable (though optimised) JS.
- leshow 8y agoyou can also enable things like "strict", then you need less team discipline, it will be enforced by the compiler. People can still use 'any' explicitly (but not implicitly), however
- jorblumesea 8y agoBut isn't that true for every software project? You need discipline to avoid most of the garbage that can be created by using any language or framework. I've seen some of the worst java apps before, but no one says "never use java". It's generally accepted that skilled engineers can make clean, easily maintainable apps, and unskilled engineers make garbage apps. This just sounds like sloppy engineering and a total lack of professional rigor.
- cetra3 8y agoI used to believe that the language didn't have any gauging on the quality of code, but I personally feel that coding in rust has made me a better and cleaner programmer, and I trust my team's rust code more than I do its java code. It's definitely an anecdotal observation though.