Hacker News new | ask | show | jobs
by _alexander_ 3817 days ago
I read this article several times, however I still have't understood how JS and WASM will be live together?

If I can use C/C++ with static typing(of course if I can do DOM manipulation from my C/C++ program) why I should use JS?

5 comments

Why would you ever use any language over C/C++? Different abstraction levels, type systems (or lack thereof), ecosystems of libraries, even syntaxes all contribute to a decision in choosing a language.

You might not like JS personally but there are plenty of things to like about it and many other people do.

In practical terms, browsers will support JS forever for backwards compatibility even if all new code is written in WASM.

Personally I really like JavaScript and I use it many years.
What happens when a monopoly is broken? A healthy competition ensues. The "misunderstood" language will still be used by devoted fans, the rest of developers will be able to have their pick as it should have been to begin with.
There was an article on the history of Internet standards that I really liked that noted the most effective and adaptable standards had all essentially been API-like rigidly-defined-but-simple boundaries.

The relationship between WASM and JS seems to be "js/js virtual machines are a de facto standard, so let's not repeat the mistakes of Java plugins and instead build off that foot-in-the-door."

C/C++ doesn't have any sensible way to interact with the DOM and the JS GC heap directly, so that's one reason you'll want javascript code to stick around. Your website/application will probably need access to some JS libraries for things like analytics, as well.
You could mix and match modules and library perhaps.

You could make the same argument about any higher level language, even those with as many quirks as JS, like PHP ;)

Because using C or C++ for a website frontend would make your code 10x longer and more likely to have bugs.
Is this assertion actually based on any data?