3 ms·
You sound like a complete novice, funboy or the one who knows only JS. There are many issues, it is possible not to touch or to work around them, TS and flow he
by sergeykish 6y ago
You sound like a complete novice, funboy or the one who knows only JS. There are many issues, it is possible not to touch or to work around them, TS and flow helps. JS solved just a few — 'use strict', strict comparison, arrow functions, string literals. Core problems still there — implicit types, prototype declarations, number is float, toString/inspect division, typeof null. Every javascript programmer has to walk that way of embarrassment.
- emteycz 6y agoLol. I've been programming for a decade in many languages including assembly, C#, Rust, Lisp, Prolog, F# and more, focusing on JS in the last 5 years. Virtually no one writes plain JavaScript, most people including me write TypeScript, but Babel with extensions is normally used. Your reply exhibits your ignorance of the JS world.
- sergeykish 6y agoI occasionally write JavaScript since 2007, experiment a lot last 5 years, red through ES5 specification several times. I've worked as C++, PHP, Python, Ruby developer. Experimented with a few languages. "JS" instead of "TypeScript" brings confusion. TS solves some issues and I've mentioned it, still typeof null //"object" Template literals interpolation helps but if string (not literal string) slips by it is a mess 1 - "2" //-1 1 + "2" //"12" Check out another comment [1], Object, Function, etc defined as constructor. It is not solved by "class", it is still a function with a bit of sugar: class Foo {} Foo instanceof Function //true Globals with a few exceptions defined as constructors, DOM elements defined as constructors, inheritance defined as constructors class Bar extends Foo {} You can internalize how it works and there are some good explanations [2] but design is error prone and terrible. [1] https://news.ycombinator.com/item?id=24815922 https://news.ycombinator.com/item?id=24815922 [2] https://yehudakatz.com/2011/08/12/understanding-prototypes-in-javascript/ https://yehudakatz.com/2011/08/12/understanding-prototypes-i...
- emteycz 6y agoThe same thing. I work in the JS world, and interact with it nonstop.
- sergeykish 6y agoOh, JS has no issues, solved by ClojureScript, PureScript, Elm.
- emteycz 6y agoThese languages are not used by virtually all JS programmers. Babel and TS is. The other issues you mention are solved by using ESLint which flags code like this. I do not encounter these issues in my life as a professional JS programmer, neither do my colleagues; and I'm not on my first project, don't worry. For all practical purposes they are non-existent. anyways, we are all happy for wasm, it's not that we love JS so much.
- sergeykish 6y agoI actually like JavaScript, with a few changes it can become a good language, safe for a novice programmer.
- emteycz 6y agoAgreed. Check out AssemblyScript, you might like that. It's early, though.
- hajile 6y agoC++ has WAY more spec footguns than JS (and that's without counting all the C undefined behaviors which alone outweight all the warts of JS combined). PHP also beats out JS for warts (and outright bad implementation like left-to-right association of ternaries). Ruby has more than it's fair share of weirdness too (try explaining eigenclass interactions to a new ruby dev). Even python has weirdness like loops having an `else` clause that is actually closer to a `finally` clause. `typeof null === "object"` is a mistake (like with most of the big ones, blame MS for refusing to ratify any spec that actually fixed them). If you're having issues accidentally replacing `+` with `-` then you have bigger issues (eg, not unit testing). I'd also note that almost all the other languages you list allow you to overload operators which means they could also silently fail as well. In any case, garbage in, garbage out. Foo being an instance of function is MUCH more honest than it being an instance of a class because the constructor in all languages is actually a function. This is even more true because you are looking at the primitive rather than the function object which contains the primitive.
- antonvs 6y ago> Virtually no one writes plain JavaScript Which is because plain Javascript is objectively terrible, as I pointed out.
- emteycz 6y agoThat's like pointing out that C++ after template transformations are applied is terrible. Yeah, so what? Nobody writes it like that.
- sergeykish 6y ago"C++ is C because nobody writes C", you can't be serious.
- emteycz 6y agoThat's not what I said.