17 ms·
These new features fix nothing, they just add more things that weren't technically needed in the first place. There is no way to "fix" Javascript without break
by galacticpony 10y ago
These new features fix nothing, they just add more things that weren't technically needed in the first place.
There is no way to "fix" Javascript without breaking compatibility. It will always suffer from its poor initial design decisions, or it will stop actually being Javascript.
- Meegul 10y agoAs someone interested in language design, what design decisions, in your opinion, make JS so terrible? The extremely weak type system?
- bluejekyll 10y agoFor me the extremely weak type system is one thing. In general the language is too accepting of bad code. It's kinda like HTML, "if you can guess at what it's supposed to do, do it." Personally, I prefer stricter interpretation over weaker versions. Another big one for me is "this", which has significantly different semantics than nearly any other OO language out there. I personally find it confusing, and it requires you in many cases to understand the invocation point of a function. I can not reason about all the data related to the scope of the function, in the function, without first taking into consideration all the callers of the function. To be fair though, JS is not the only language that features these flaws. The biggest problem with it is that I'm not really given a choice to use other languages. Yes, there are transpilers, but even with those I almost always need to use JS at some point for integration with other code.
- loppers92 10y ago- Bad Performance - Extremely weak type system - No generic language - Too many abstractions - Double behavior of types - Bad scaling - Extremely bad OOP Implementation (Just 1% of OOP) - the Debugging approach doesn't make any sense - The Community (1000+ Frameworks with almost the same features for what existing standards?????)
- allover 10y ago> - Bad Performance It's one of the fastest dynamic languages in existence, considerably faster than e.g. Ruby and Python > - Extremely weak type system Compared to what? It's a dynamic language. > - No generic language - Too many abstractions - Double behavior of types - Bad scaling - Vague, what does these even mean? Compared to what? > Extremely bad OOP Implementation (Just 1% of OOP) Again vague, what is it lacking? Perhaps it just implements the bits people actually use? > the Debugging approach doesn't make any sense No idea what this means. Chrome devtools debugger is excellent. > The Community (1000+ Frameworks with almost the same features for what existing standards?????) It's a huge community, there're bound to be lots of camps and lots of people trying to crack the same nut different ways. What's wrong with competition? I personally think it's a fantastic community, and find others lacking by comparison.
- chc 10y ago> It's one of the fastest dynamic languages in existence, considerably faster than e.g. Ruby and Python I think this is kind of a question of what it means for a language to be fast. The big browser companies have poured a mind-blowing amount of resources into making their JavaScript engines fast. This has made these JavaScript engines faster than other implementations of slow languages that have not had similar resources devoted to performance. But this does not mean "JavaScript is fast" in the sense that the design of JavaScript readily enables good performance, and it doesn't make JavaScript fast relative to actually fast languages. > Compared to what? It's a dynamic language. JavaScript's type system is extraordinarily weak even compared to most popular dynamic languages. For example: $ python -c "print(1 + '1')" Traceback (most recent call last): File "<string>", line 1, in <module> TypeError: unsupported operand type(s) for +: 'int' and 'str' $ ruby -e "puts(1 + '1')" -e:1:in `+': String can't be coerced into Fixnum (TypeError) from -e:1:in `<main>' $ node -e "console.log(1 + '1')" 11
- allover 10y ago> I think this is kind of a question of what it means for a language to be fast [...] It's significantly faster than most other dynamic languages. It's fast as a compilation target to the extent we can run Unreal Engine in the browser. So I consider the original comment I replied to that simply stated 'Bad performance' incorrect or at least lazy/contextless criticism. If you want to reframe, fine, but I'm not going there :) Accidental string coercion is a valid point. Also hasn't bitten me in ~10 years of building large JS apps. And JS has many advantages over e.g. Python these days that to me vastly overshadow that downside (better support for FP for one). (And if you really want that type safety you can use TypeScript, just another great thing to come out of the JS community, you know the one that GPP criticised for daring to provide choice).
- galacticpony 10y agoI believe the flaws are well-documented and there isn't much dispute over them, though not all of them are real problems. I also don't think it's the lack of language features that makes it bad. This is something that is getting addressed. What really does cause problems is the basic types, the type "system" and the way numbers are treated/represented.
- sqeaky 10y agoI disagree because of the changes I have in C++ between C++03 and C++11. Compatibility was not broken there, and writing with the new features is a breeze but the option to drop to the old stuff when required still exists (even though it is slow and buggy). I am not javascript expert, but it seems that the the choices in the newer versions of Javascript are similar to the new changes in C++. No language can make it impossible to prevent bad decisions, but the newer versions of these languages can make good decisions easier.
- MaulingMonkey 10y ago> Compatibility was not broken there Rewriting a codebase that had: #define static_assert(x) ... Was "fun" (tm) (C++11 adds a 2-argument keyword, C++17 adds a 1-argument overload that finally undoes the need for the rewrite.) I'll also note we have vastly different standards as to what it would take to "fix" C++. atoi("9999999999") can still launch nethack (undefined behavior!), and C++11's response is to add a new overload, atoll. C++17 still doesn't have modules (TRs aside), still has a grammar that's so obscene to try and parse that compilers still disagree on some of the finer points, and still thinks "undefined behavior" is a hip new metal band to name drop for cred, rather than a last resort. This is not to say we shouldn't try to improve the language anyways, but compatibility was and will continue to be broken (hopefully in small ways that generate compile errors), and C++ will continue to suffer from it's initial design, and it will continue to do so for as long as it remains C++.
- sqeaky 10y agoFix the static assert should have been trivial, it should have been just a find and replace. Just like any other new keyword in any other new update to a language. The only exception might be if you used string concatenation during macro resolution, if that is the case it shouldn't have worked in the first. atoi causing undefined is not a real complaint because it has always caused undefined behavior. You can't blame changing that on the standard or the new version of C++ because it was already allowed to change with every execution of the program. Trying to fix non-determinism is a good thing because well formed code should already be avoiding these undefined behaviors. Why do and others try to complain when you use undefined behavior and are surprised when it changes in undefined ways? You specifically asked to not be able to know the answer.