4 ms·
TypeScript has been on HN for different reasons over the last few days. The main thing that has stood out, from the flame wars erupting over it is that it is a
by orange8 7y ago
TypeScript has been on HN for different reasons over the last few days. The main thing that has stood out, from the flame wars erupting over it is that it
is a truly divisive idea. To some, it gives the same securities and checks provided when working with a statically typed language. To others, it curtails the power and expressiveness inherent in JS, the dynamic, functional language it compiles down to.
TypeScript does provide a lot of benefits, but for it to truly succeed and take over in the JS world would mean it has to truly also reflect, and enable JS's functional and dynamic roots. JS got where it is by being JS.. an extremely flexible and accommodating language. HTML got this far today by doing the same, just google XHTML if you doubt that. So for TypeScript to succeed where CoffeeScript failed, this may be the direction it needs to lean more towards: being less divisive, and inviting all kinds of programming paradigms to the party.
That, after-all is how JS succeeded.
- scarface74 7y agoJS got where it is by being JS.. JS got where it is solely by being the language built into browsers.
- orange8 7y agoIs that really all it is though? Cases in point: Java Applets, VB, Flash, Dart ... All of these were at one point or another "built into the browser", but where are they now? Give credit where it is due, the success of the web as a platform lies not in its technical superiority over alternatives, but in its inclusiveness and flexibility. Any tech that is trying to replace HTML, CSS and JS in this regards will seriously have to consider and accommodate this, or suffer the same fate of hundreds of other pretenders to the throne. Long live the king! Long live open, approachable and flexible tech! Exhibit A: List of very different and diverse languages that compile to JS ( https://github.com/jashkenas/coffeescript/wiki/List-of-languages-that-compile-to-JS https://github.com/jashkenas/coffeescript/wiki/List-of-langu... ). If this does not demonstrate the flexibility and malleability of the language, then I do not know what does. Take web assembly for example, which has been around for over five years now, and was specifically designed as a "compile to" language. How many languages compile to web assembly in comparison? Any tech that is as divisive as TS is simply not going to get far. Flash ActionScript was massive 10 years ago compared to any alternative to JS tech today, and where is it now? The creator of TS even quotes ActionScript as one of the main inspirations for TS. ActionScript even had a more powerful version of Reacts JSX (ES4), where is it today? CoffeeScript was all the rage 5 years ago, JS simply absorbed all its good ideas, where is it today? The things that last, that stand the test of time are the things that are flexible and accommodate different ways of doing things. For your beloved TS to stand the test of time, it has got to accommodate the whole JS eco-system, not just those who favor the static object oriented way of doing things.
- acemarke 7y agoI'm not sure why you're talking about "object oriented". TS, in and of itself, has nothing to do with OOP. You can write functional-oriented code in TS same as you would in JS. TS doesn't mandate use of classes or anything like that. As an example, I can write a React+Redux app in TS, and be writing 100% plain functions (components + reducers) the entire way through. From my viewpoint, TS has more than hit enough critical mass to survive for the long term: - Microsoft is heavily invested in its ongoing development - The Angular community requires use of TS - The React community has split in general between types and no types, but a recent survey of /r/reactjs readers indicated ~50% of React devs are using TS [0] - Where CoffeeScript introduced new syntax entirely, TS's focus on being a superset of standardized JS means that there's both less to worry about compat-wise _and_ it can be seen as a way to use new language features instead of Babel FWIW, I wrote up my thoughts on learning and using TS as both an app dev and a Redux maintainer [1], and I'm sold on using going forward. [0] https://www.swyx.io/writing/react-survey-2019/ https://www.swyx.io/writing/react-survey-2019/ [1] https://blog.isquaredsoftware.com/2019/11/blogged-answers-learning-and-using-typescript/ https://blog.isquaredsoftware.com/2019/11/blogged-answers-le...
- orange8 7y agoOOP is not just about using classes, just like functional programming is not just about using functions. They're different programming paradigms, each with their own patterns, strengths and weaknesses. Idiomatic TS favors an OOP style, which is why there are event libraries out their [0] whose sole goal is to enable using TS the functional way. > The Angular community requires use of TS Angular was once the king of the JS frontend, but now it has more or less been reduced to a certain niche in the market. It is no accident that it is very popular among those with a Java background, with Java being a very good example of a static OOP language. > The React community has split in general between types and no types That split is being caused by TS. This is not a good thing for the eco-system as a whole. The idea that everyone will be forced into adopting TS because of the power of MS is the very idea that will lead to a backlash, just like the backlashes against XHTML and Java applets. [0] https://github.com/gcanti/fp-ts https://github.com/gcanti/fp-ts
- 7y ago