That's probably true, but C++ does provide very powerful compile-time evaluation mechanisms like templates, constexpr (compile-time evaluated constants and functions), and template metaprogramming. That being said, compile-time C++ can look very gross since most of the features are accidental.
However, there are a lot of huge performance benefits to moving computation to compile time: selecting the most optimal algorithm for a type, guaranteeing you don't mismatch your units, precompiling search (glob, regex) engines, eliminating dead code, and so on.
So I would be shocked if at least some javascript applications couldn't be much faster and more correct by writing in C++ first and compiling to js. That being said, it's probably not in scope for a minimum-viable product, so improving already business-critical parts of the code base might be the best place to start.
I wouldn't write a web-only app in C++, but if the same code needs to run on other platforms as well (e.g. native mobile, desktop or gaming consoles) then C/C++ is basically the only choice. Also, at least in emscripten, compiled code is faster then hand-written JS for several reasons (asm.js, LLVM optimizer passes, no gc), so it makes sense to write stuff like physics/pathfinding/AI engines in C/C++ and compile it to JS.
Plus, it's fun to write a desktop OpenGL demo, flip a build system switch and run it in the browser ;)
If that was the case, http://asmjs.org/ wouldn't be a thing.
[0] https://code.google.com/p/v8/issues/detail?id=2599#c53
[1] http://mrale.ph/blog/2013/03/28/why-asmjs-bothers-me.html
asm.js does little for you if you write "real JS", but this thread is about cross-compiling other languages, which clearly has real world use.
But if I recall correctly, there are very good reasons why we don't have that in our browsers; security concerns maybe? Anyone?
Or http://hn.algolia.com, here I go again!
(What a great post, thanks for linking. Even though I follow mraleph on twitter, I had never opened his website. Probably because it all looks like scary compiler stuff.)
For example take something like Dropbox's Carousel architecture, which shares the client side cache, date model, and sync client between iOS and Android via a C++ library. Something like Cheerp or Emscripten allows you to also use this same library on the web.
Performance is a big reason people use C++, but there are many others. For example, people also write C++ when correctness is critical (bank software, safety-critical systems, etc.).
The vagaries of the standard aren't issues since safety critical software is validated on a per-platform and per-compiler basis. Memory safety is certainly a concern during the development process but more importantly (!) GC languages (like javascript and Scala) do not have provably (for some value of provably) deterministic execution times. Determinism is also a problem for lazy languages (like Haskell).
I say that to say the zero-cost abstractions of C++ is a huge benefit when writing safety-critical software. The level of control over emitted binaries is essential and fairly rare in programming languages.
> If they are really doing this, they have no idea what they are doing.
Well, I can't speak for entire industries, but that's a pretty sweeping generalization. You might be surprised what the challenges are when writing safety-critical systems software. That being said, I'm sure large portions of the industry are ripe for innovation.
This is not unique to GC languages, but any languages with dynamic memory management. C++ new/free and STL abstractions built on top are not provably deterministic either. And if you program without ever touching dynamic memory (statically allocating and pooling everything) then GC is not a concern.
> I say that to say the zero-cost abstractions of C++ is a huge benefit when writing safety-critical software.
You're talking about performance now, not correctness. All those benefits get lost once translated to JS.