by randomfool · 8y ago · 0 comments
Frontend is massive, why would one suppose that a single solution would work for everyone?
Horrible metric, GitHub stars:
- 104k React
- 58k Angular.js
- 43k Go
- 42k WebPack
With JavaScript, it is the only choice available, so if you want a different style of programming you have to involve all kinds of additional tooling in addition to the language's native tooling, on top of having to involve JavaScript's tooling, frontend package manager, backend package manager, transpillers, babel, gulp etc. etc. it's just a mess, not really comparable with having to invoke Bundler or Cargo for the backend side of things.
> Frontend is massive, why would one suppose that a single solution would work for everyone?
The problem is that JavaScript is the single solution that essentially has to work for everyone right now, hence the push for WebAssembly.
It doesn’t touch the DOM and there’s a VERY good reason for that.
To which most advocates end up saying that’s because the DOM is bad and should be scrapped. Maybe, but now we have put the cart firmly so far in front of the horse that’s is a few days ride away.
Yes, because they haven't gotten to it yet and wanted to release the MVP without that functionality. But that feature is coming (hint: it's called host bindings), so implying that there's some other reason why DOM access from WASM wasn't added is pretty disingenuous. Once that feature and garbage collection arrive in WASM, there will be almost no reason why JS needs to be used on the front end.
Which it will anyway so WASM devs will end up having to be just as careful as JS devs about DOM & UI manipulations or run into the exact same problems.
At which point (the the same problems and issues) there’s really no reason to use anything other than JS for that portion of the application.
WASM is great, but it’s going to be for the parts of the web that JS is not good at dealing with - and that’s less than the crowd here on HN would like to believe.
Are they here yet? No. Are they performant yet? No idea because they don’t exist.
They’re always brought up by WASM advocates like they solve anything. But they don’t... because the problem isn’t accessing the DOM - it’s doing it performantly in your code and there’s nothing about host bindings that hint they’ll solve that problem any better than JS. So far the signs aren’t positive.
I would not argue one solution fits all. I think having the ability to write frontend+backend in JS _and_ Go is a good thing.
I mean, I bet that as soon as possibile all the c# consultancy companies - just to pick a common example of big teams using a single language for the backend systems of all the projects of the company - would switch also their frontend to c# when it is supported by all major browsers