4 ms·
Wild how people can have such different experiences. Typescript is hands-down one of my favorite languages, and I would choose its structural type system over J
by phailhaus 5y ago
Wild how people can have such different experiences. Typescript is hands-down one of my favorite languages, and I would choose its structural type system over Java's any day. I also use Python at work, and it's like night and day in terms of quality. Every day I have to deal with fundamentally unresolvable issues due to Python's half-baked type hints, when I could be writing much more stable, functional, and maintainable Typescript.
Calling it "broken" is complete hyperbole, and no, it's not "worse than Javascript". There's a reason why the entire ecosystem is switching to Typescript, and that's because it is extremely effective at helping teams manage complex stateful applications.
- FpUser 5y ago>"Calling it "broken" is complete hyperbole" Well, when comparing it with strongly typed languages it does look broken for sure.
- masak 5y agoThis reply is a good example of how "strongly typed" ends up meaning practically nothing -- except possibly "the kind of type system I prefer". I once attended a talk where the speaker had identified half a dozen axes that papers or projects were calling "strong"/"weak" with relation to type systems. Some were not even consistent with themselves, switching definitions halfway. Type systems are tools, whose formal properties can be described and analyzed in precise detail. Unfortunately, that kind of precision is hard, so semantically empty words like "strong" get used a lot instead. This message is intended to raise awareness about that fact.
- FpUser 5y agoWell one can analyze that type systems are till the hell freezes over. I personally do not care as this precise knowledge (assuming it is formalized and exists) is of zero value to me. When I want to walk I just do. I do not dwell on the details of the walking process. Anyways most likely you do know well what I meant. JS vs C++ for example.
- masak 5y agoNeither the type system of C++ nor the type system of TS is sound, in the sense of "the type system rejects all incorrect programs". If what you meant by "strong" is just "you can declare types on variables", then both TS and C++ qualify as strong, but JS doesn't. Your use of the word is based on feeling, not fact. Which was my point.
- FpUser 5y agoTypescript compiles down to Javascript. And this is the problem. When I say uint16_t in C++ I know how it will be kept in RAM and what I can do with it, how I can pack things together etc. etc. TS lacks this abilities. You can play with terminology all you want but it does not change simple facts.
- kaba0 5y agoYou could (probably can) compile C++ to JS. What will that be? In the end, code is just data operating on data with no semantics. Your uint16_t is only meaningful to the compiler, the same way as TypeScript types are (with a few caveat).
- ragnese 5y agoWell, sure, compared to Python, I guess TypeScript's type system is pretty great... Its type system is quite broken and I'm not going to walk back on using that term. Sometimes the TypeScript designers/devs will explain that the brokenness is intentional. But some of the issues have nothing to do with JavaScript compatibility. For example, we all know about the conundrum of `type` vs `interface`, but did you know that an object-shaped `type` will automatically conform to a mapped type, but an `interface` wont? Playground: https://www.typescriptlang.org/play?ssl=20&ssc=1&pln=21&pc=1#code/JYOwLgpgTgZghgYwgAgLIE8CS5rycgbwFgAoZc5OALmRAFcBbAI2lIF9TSx0AHFDACq8UAXkKkKlGvWasSHEl2FosOWIggBBADbA4AZ2RiA8g2BgAPBmyR1SADTIA5E4B8nEgBMICbXCgoMHQgCGDAAPYgyDDh4QAUUDQASj7hUJ4W+mBQoADmjjIsUK4AlDQAbuHAnqTevv4oCJFZyAyqtngQNNZqnbU+fgHITSAtbUJ83egTEP31QyNj7bgaOnr6UzYrSGsGHgD0+8PhDDzA2tBGrXA1JDHxbVt2ECWkh8en55diABZwPDx0KR7nFxsJXiR3k1PhcoFc-gCgXdYqDls9dvoSkA https://www.typescriptlang.org/play?ssl=20&ssc=1&pln=21&pc=1... Or how about the fact that basic inheritance sub-typing doesn't work?: https://www.typescriptlang.org/play?#code/MYGwhgzhAECCB2BLAtmE0DeBfAsAKFEhgGEwAXaAUwA8zL4ATGBFNTfaT6ZSgewHcAFAEoAXNABuvRA3Z4uC6MF7wIvEJQB0IXgHNBAIh4CDwjl1x5LhKNAAieqrXpM4SVOgznOAIzAAnAGsRcSkZOUUuZVV1LR19Az8g029oS0t8RHg6fwAzMGBKaAAJSAAFSgoveS4AB0rxFg98DLwsnPzCksgHXQi6hvs9Fvx8XIBXeGAyRBVuMCRa8fA6CrJBXnFSiDXhfs5eTXqKAF5oeEp+aFJ1sytRghUICk3uiF7oM+qFY-ELq96IhGeHwqEWy3IlDWGzu+EOx00SWCewA9CilLxkLVEBp-NBEDB6nlKNMQABPaAACzAtVqZIAhEA https://www.typescriptlang.org/play?#code/MYGwhgzhAECCB2BLAt...
- zarzavat 5y agoWho cares if TypeScript's type system is unsound if it lets you express things that you cannot express in a nominative system like Java's. I get so much more productivity out of TypeScript's type system than any other language including "serious" type systems like Haskell's. Moreover TypeScript's type system is so powerful it actually catches a good number of bugs that Haskell would never catch, because it does control flow analysis by default. For many languages you would need to install a separate static analyser (if one even exists), having CFA as part of type checking in your editor is godlike. Sure if you are writing software for a radiotherapy machine, don't write it in typescript! Use whatever proof assistant takes your fancy. But if bugs are not literally going to kill people, TypeScript's type system is about the best in existence.
- 5y ago