News for hackers. Stuff that matters.
Re:All About E: The Language That Infiltrated JavaScript by oofbey on Thursday October 27, 2022 @12:35AM (#33353156)
Doesn’t WASM provide a graceful and natural end to JavaScript’s hegemony? People can just use whatever language they want in the browser now.
Re:All About E: The Language That Infiltrated JavaScript by Mikeb85 on Thursday October 27, 2022 @12:38AM (#33353174)
No because most languages don't just compile to WASM... You need to compile and distribute a runtime or, in the case of dynamic languages, full interpreter with the web page. JS is way less code to ship depending on how much interactivity you want...
Re:All About E: The Language That Infiltrated JavaScript by berkes on Thursday October 27, 2022 @10:43AM (#33358266)
> You need to compile and distribute a runtime or, in the case of dynamic languages,

But for all other languages there are easy compilers. Which is why WASM, apparently, is used with such languages mostly[1]

I'd expect that these runtimes can be both distributed with browsers when they become really popular, and can be reduced in size. E.g. Python's runtime is relatively large and ships with a large stdlib. Most of which won't be needed in your code, so I'd expect it to be possible to compile a runtime that only includes what your code really needs, for example.

[1] https://blog.scottlogic.com/2022/06/20/state-of-wasm-2022.ht...

Re:All About E: The Language That Infiltrated JavaScript by pjmlp on Thursday October 27, 2022 @02:57AM (#33354145)
JavaScript is still the language that owns the platform, because WASM doesn't have any capabilities beyond compute, it up to the host to provide callbacks so that WASM code can call into the host, those callbacks are written in JavaScript.
Re:All About E: The Language That Infiltrated JavaScript by dmitriid on Thursday October 27, 2022 @03:56AM (#33354543)
> People can just use whatever language they want in the browser now.

Except, you know, WASM has zero access to browser APIs, and all interactions have to go through JavaScript.

And on top of that you need to load your language's entire runtime to make it work.

Re:All About E: The Language That Infiltrated JavaScript by DeathArrow on Thursday October 27, 2022 @09:12AM (#33356965)
>Except, you know, WASM has zero access to browser APIs

True, and we have to wonder why is this still the case?

Re:All About E: The Language That Infiltrated JavaScript by pmontra on Thursday October 27, 2022 @03:58AM (#33354557)
WASM does not interact with the DOM AFAIK. Of course one might (and probably somebody did) create a JavaScript programs interfacing a WASM web worker that sends user input in the JS -> WASM direction and executes DOM manipulation commands in the other one. All masked as a DOM library of the language that was compiled to WASM. Efficient? Probably no. Fast enough? Probably yes.
Re:All About E: The Language That Infiltrated JavaScript by 7373737373 on Thursday October 27, 2022 @05:03AM (#33355042)
Re:All About E: The Language That Infiltrated JavaScript by DeathArrow on Thursday October 27, 2022 @09:11AM (#33356951)
>Of course one might (and probably somebody did) create a JavaScript programs interfacing a WASM web worker that sends user input in the JS

Of course someone did. Check out Blazor. :)

https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blaz...

Re:All About E: The Language That Infiltrated JavaScript by pmontra on Thursday October 27, 2022 @11:17AM (#33358841)
Thanks. In the early 90s there was "the law of Internet": if you can think about something somebody already made it and put it online. And it was a really tiny net compared to today.
Re:All About E: The Language That Infiltrated JavaScript by DeathArrow on Thursday October 27, 2022 @09:09AM (#33356935)
>Doesn’t WASM provide a graceful and natural end to JavaScript’s hegemony? People can just use whatever language they want in the browser now.

Not really since you can't manipulate the DOM from WASM.

Re:All About E: The Language That Infiltrated JavaScript by berkes on Thursday October 27, 2022 @11:12AM (#33358755)
That presumes that most of what JS does it "manipulating DOMs". At least in my frontend-code, this isn't the case. There is nearly always a much larger part that communicates with backends, sockets, HTTP, manages state, business logic and -validation etc.

The "writing it to screen" is often a rather thin layer. At least in my projects.

Re:All About E: The Language That Infiltrated JavaScript by oofbey on Thursday October 27, 2022 @12:19PM (#33359873)
You probably wouldn't want to have to code in multiple languages even for a thin layer. Somebody could build that thin JS layer once for your language. Sounds like that's happening.