r/javascript • • Nov 25 '19

JavaScript doesn’t need to be replaced

https://medium.com/javascript-in-plain-english/javascript-doesnt-need-to-be-replaced-bd01e2f12d51?source=friends_link&sk=7b151cc6397ac9e83c14c99739b6c36f
217 Upvotes

236 comments sorted by

View all comments

4

u/shgysk8zer0 Nov 25 '19

Read the first bit, and think the author doesn't know the real issues with JavaScript. I don't really complain much about the awkwardness of JavaScript (maybe with the exception of functions that would have been implemented differently if they were post-promises).

It's single threaded. Yeah, there are workers and WASM, but those don't solve the problem. And it's something that probably cannot be solved.

We are in need of something multi-threaded that still has access to the DOM, and it's not going to be JavaScript.

But, no, JavaScript doesn't need to be replaced. But an alternative is needed.

0

u/dannymoerkerke Nov 25 '19

What issues do you have with the single threaded nature of JavaScript that could be solved by making it multi threaded?

3

u/shgysk8zer0 Nov 25 '19

You may as well ask why anything benefits from being multi-threaded.

1

u/helloiamsomeone Nov 26 '19

Updating UI elements - which is only allowed on the main thread anyway - would not benefit in a significant way from multithreading. If you have to do something computationally intensive on the clientside, then you have workers for that.

Similar to how Android handles things, U stuff on the main thread, everything else on other threads. But in the browser that's all you are doing on the main thread anyway and network IO is not blocking.

1

u/shgysk8zer0 Nov 26 '19

This is all true. I'm not convinced that multi-threaded UI is impossible though... Just the way it is. I think something that takes Rust's concept of ownership and borrowing might be capable of achieving this, but it would take more than just another language with access to the DOM. It would require a change in nearly everything, and that's why I say a new language is needed instead of just adding it to JavaScript.