6 ms·
"Is Typescript worth it?" No, but not because the tired diatribe on typing, but because JavaScript nowadays is mostly good enough... As long as we remember wha
by luord 7y ago
"Is Typescript worth it?"
No, but not because the tired diatribe on typing, but because JavaScript nowadays is mostly good enough... As long as we remember what its goal is and we don't use it for anything more than its intended purpose.
That aside, everything in that post re soundness vs unsoundness was what I used to know (and was taught in college) as "strong" and "weak" typing, is the redefinition recent? Was I taught incorrectly? That aside, C is weakly typed (and there are long, long discussions on it) but I'll say that, if it's good enough for C, then being for or against it becomes pretty much subjective (obligatory IMO, my saying that at all is also subjective).
After all, it's a flamewar that's been going on for decades. Typescript certainly isn't going to solve it.
- tel 7y agoSound and unsound aren’t the same as strong and weak. Weak and strong systems aren’t honestly very well defined, but under many definitions can be both sound and unsound, though the theory of the weak system will need to have explicit inclusion of the implicit casts (e.g.). Type systems become unsound when they, as a total system, cannot uphold their own promises. The promises of a weak system are weaker, but not (always) non-existent. In an unsound system you can generally, through trickery, take any expression reducing to a value of some type and modify it so that it appears to reduce to any other type at whim.
- luord 7y ago> Weak and strong systems aren’t honestly very well defined I see, but at least the literature I read on typing actually mentioned them. Nothing I read in college regarding type systems ever included the words "sound" or "unsound". > some type and modify it so that it appears to reduce to any other type at whim. I saw instances of this as examples of "weak" typing. Do you happen to have papers or books you could recommend so that I can learn more on type system soundness? This is a subject that I find really interesting.
- TheDong 7y agoHow were weak and strong defined in the literature you read? Anyway, more on soundness. I can recommend a couple papers: Wadler (inventor of the monad) wrote a paper called "Well-Typed Programs Can’t Be Blamed" [0] about soundness. There was a recent paper that made the rounds about how java's type-system is provably unsound as well that's worth reading [1]. I second the parent comment that weak and strong are ill-defined in my experience, while sound/unsound have well-accepted definitions and are commonly used in academia. Your experience obviously differs for whatever reason. You can find many other references to soundness in the citations of those papers, as well as scattered around the internet. [0]: https://link.springer.com/chapter/10.1007%2F978-3-642-00590-9_1 https://link.springer.com/chapter/10.1007%2F978-3-642-00590-... [1]: https://dl.acm.org/doi/10.1145/2983990.2984004 https://dl.acm.org/doi/10.1145/2983990.2984004
- archon-99 7y agoThe definitions are: Static: Statically checked by a compiler. Dynamic: Not Statically checked by a compiler Strong: Types enforced by the runtime Weak: Types not enforced by the runtime Of these, JavaScript: Dynamic, Weak TypeScript: Static, Weak C#: Static, Strong As to if you think TypeScript is worth it, of course its worth it. Whether or not you're writing JavaScript or TypeScript, you're still thinking in types, function signatures and data structures. TypeScript allows you to encode that information so you don't need to hold it in your head (or have other programmers figure it from usage, as would be the case for JavaScript). But that aside, TypeScript's tooling alone makes it worth it. As for this flame war, i strongly suspect that most type system advocates have mostly likely used BOTH dynamic and static languages (C#, Java programmers have had to deal with JavaScript for decades), while I expect the majority of dynamic advocates (say Python, PHP, JavaScript) have primarily stuck with dynamic. Those with the wider perspective have the better insight imo.
- luord 7y agoI am aware of those definitions. It was "sound" and "unsound" what threw me off. > Whether or not you're writing JavaScript or TypeScript, you're still thinking in types, function signatures and data structures. TypeScript allows you to encode that information so you don't need to hold it in your head Static vs dynamic, a flamewar that's over sixty years old to which I am not going to contribute. > But that aside, TypeScript's tooling alone makes it worth it. JavaScript has pretty good tooling too. > As for this flame war, i strongly suspect that most type system advocates have mostly likely used BOTH dynamic and static languages (C#, Java programmers have had to deal with JavaScript for decades), while I expect the majority of dynamic advocates (say Python, PHP, JavaScript) have primarily stuck with dynamic. Should we ask LISP developers? How about its derivates like Clojure or Scheme? There are many of them here in HN (in fact, I've dabbled on Clojure a little bit myself), though that would probably lead to a different flamewar entirely (functional vs oo). In any case, I don't follow what point you were trying to make writing this suspicion, it was clear that you were going to get counterexamples and you didn't provide sources that at least gave support to having such a suspicion. I would appreciate if you elaborated what was your implication. By the by, I worked in java during 2013 and 2014, and I've been working with Go exclusively for nearly a year now. I still don't really care about what type system any given language I've worked on has, there's good and garbage code everywhere. Though, since all this can only be opinion until someone conclusively demonstrates a given type system's superiority, I still prefer writing python code. > Those with the wider perspective have the better insight imo. Maybe we should ask Guido van Rossum's perspective.