Earlier quoted context omitted.
I have no idea what you mean by JavaScript being "easier" to learn than C++. My experience has been the exact opposite. C++ is a giant beast, but most of it was relatively easy to learn after I internalized the general principles that guide the language's design. These principles were the first coherent account I ever found of how programs manipulating ephemeral resources should be written. [I am aware that Rust impr…
> I have no idea what you mean by JavaScript being "easier" to learn than C++. My experience has been the exact opposite. You are a tiny minority in this. I've taught C++ and JS and have never once seen JS be harder to pick up. > On the other hand, in JavaScript I have never found anything even remotely close to methodological guidance for writing programs. The #1 selling JS book is (was) literally called "JavaScript…
I'm talking about guidance from the language itself, not external parties. For instance, C++ templates don't provide such guidance - it's very difficult for C++ compilers to tell you where and how exactly you're using templates wrong. On the other hand, C++ destructors do provide such guidance - just put all your finalization logic in destructors and you're done.
> That's (a) not true, with the static resolution semantics in modules
Even with strict mode and statically resolved imports, JavaScript requires extremely defensive programming to get useful diagnostics when anything goes wrong beyond using identifiers not in scope.
> (b) to the extent that it is true is mostly a criticism of dynamic typing
Python (not to mention Scheme, which JavaScript is allegedly inspired by) is dynamically typed, but does a much better job of treating nonsensical code as an error.
> Memory safety? GC?
It's true that garbage collection makes memory management a non-problem in the vast majority of situations, but it doesn't even begin to address managing other resources. Unfortunately, a program whose only avilable resource is memory (and perhaps the standard streams) is nothing but a fancy calculator.
RAII is a comprehensive solution to a wide class of problems that includes memory management as a special case, so I think C++ wins this one.
> A module system (as compared to #include)?
Of course, you're completely right about this.
> Dynamic typing?
I can get exactly as much dynamic typing as I need in C++ programs, without affecting the parts that are meant to be statically typed.