top | item 46556647

(no title)

codelikeawolf | 1 month ago

> Do that and frontend web-apps will throw JS into the gutter within a decade.

Why though? What's wrong with JS? I feel like it's gotten a lot better over the years. I don't really understand all the hate.

discuss

order

tpm|1 month ago

> What's wrong with JS?

Let's not go into that for the millionth time and instead perhaps ask yourself why is TS wildly successful and even before that everyone was trying to use anything-but-js.

codelikeawolf|1 month ago

> Let's not go into that for the millionth time

Ok, that's fair. My goal with this question wasn't to open a can of worms. But whenever I see a strong averse reaction to JS, I assume that the person hasn't tried using _modern_ JS.

> why is TS wildly successful

From my perspective, it stops me from making stupid mistakes, improves autocomplete, and adds more explicitness to the code, which is incredibly beneficial for large teams and big projects. But I don't think that answers my original question, because if you strip away the types, it's JS.

> even before that everyone was trying to use anything-but-js

Because JS used to suck a lot more, but it sucks a lot less now.

homarp|1 month ago

it is not hate. It is same reason people likes node on the backend: one language to do eveything.

Wasm with 'fast' DOM manipulation opens the door to every language compiling to wasm to be used to build a web app that renders HTML.

codelikeawolf|1 month ago

I don't mean to split hairs here, but considering the wording of "throw something in the gutter", I would argue that "hate" isn't really too far off the mark.

> Wasm with 'fast' DOM manipulation opens the door to every language compiling to wasm to be used to build a web app that renders HTML.

This was never the goal of Wasm. To quote this article [1]:

> What should be relevant for working software developers is not, "Can I write pure Wasm and have direct access to the DOM while avoiding touching any JavaScript ever?" Instead, the question should be, "Can I build my C#/Go/Python library/app into my website so it runs with good performance?"

Swap out "pure Wasm" with <your programming language> and the point still stands. If you really want to use one language to do everything, I'm pretty sure just about every popular programming language has a way of transpiling to JS.

[1] https://queue.acm.org/detail.cfm?id=3746174

SR2Z|1 month ago

Then why not allow WASM to access the DOM?

codelikeawolf|1 month ago

Wasm is essentially a CPU in the browser. It's very barebones in terms of its capabilities. The DOM API is pretty beefy, so adding DOM support to Wasm would be a massive undertaking. So why add all that complexity when you already have a perfectly capable mechanism for interacting with the DOM?

drysart|1 month ago

There's not some conspiracy that's stopped it from happening. Nobody, anywhere, has ever said "DOM access from WASM isn't allowed". It's not a matter of 'allow', it's a matter of capability.

There's a lot of prerequisites for DOM access from WASM that need to be built first before there can be usable DOM access from within WASM, and those are steadily being built and added to the WASM specification. Things like value references, typed object support, and GC support.