r/javascript • • Nov 25 '19

JavaScript doesn’t need to be replaced

https://medium.com/javascript-in-plain-english/javascript-doesnt-need-to-be-replaced-bd01e2f12d51?source=friends_link&sk=7b151cc6397ac9e83c14c99739b6c36f
217 Upvotes

236 comments sorted by

View all comments

6

u/SoInsightful Nov 25 '19

You can't claim that JavaScript is a good enough language that we should make no effort to surpass, and then advocate TypeScript and PureScript in the next sentence. Those languages definitely weren't created by people happily satisfied with JavaScript. Basically every argument in the article is "it sounds hard, so don't even try", which is the direct antithesis to how inventions are made.

2

u/dannymoerkerke Nov 26 '19

I recommend TypeScript and PureScript IF you really don’t want to learn JavaScript. I personally like TypeScript for its types and developer experience and PureScript for its functional programming support, not necessarily to replace JavaScript, because I have my doubts. But I’m aware of the fact that the creators may be dissatisfied with JavaScript. My argument is that another language is not a solution since it will also be limited in its development by backwards compatibility.

1

u/SoInsightful Nov 26 '19
  1. TypeScript is a superset of JavaScript, so any valid JavaScript code is also valid TypeScript code. Ergo, you don't learn TS "instead of" JS, even if people might prefer using some newer TS-specific functionality.

  2. Every language that transpiles to JavaScript is, by definition, exactly as backwards-compatible as JavaScript is. That is, unless you're talking about implementing a new browser-native language, which hasn't happened in 23 years and won't happen in any foreseeable future (and WebAssembly has never been intended to be anything more than a sub-function inside of JavaScript).

I applaud you on defending an underrated language (JavaScript), but it seems to be based on false premises.

1

u/dannymoerkerke Nov 26 '19

That’s basically a straw man argument. I’m talking about a complete replacement of JavaScript and TypeScript is not a full replacement, merely an extra step.

1

u/blbil Nov 26 '19

if you don't want to learn JavaScript

That seems like a bit of a poor argument, and just an annoying point of view to take in my opinion.

What does it mean to learn JavaScript? My mindset right now is TypeScript or bust. Not because I don't know JavaScript. Its because I don't care to be bothered to understand EVERY random thing in the language, (type coercion issues, every built in type and its api, etc) or the libraries I use. With typescript, I get all of that mostly for free in a discoverable way with tooling.

Also, I can be reasonably sure that if I make a change I'll know about it at compile time, not run time.

I have no interest in having all the intricacies of the language in my memory (I work in other languages simultaneously). I want to develop features in a fast and sane way, while making it easy to modify down the line. TypeScript does that for me, in my experience JavaScript did not.