News for hackers. Stuff that matters.
Re:Missing the Point of WebAssembly by jauntywundrkind on Tuesday January 09, 2024 @02:45PM (#38930969)
While I don't necessarily agree with the unnecessary, unsupported, casual, & cheap (provided with zero substantiating/contestable support) contempt culture here ("unshackle the web from the mess that is JavaScript", "places that don't really need these problems to be solved")...

WebAssembly component-model is being developed to allow referring to and passing complex objects between different modules and the outside world, by establishing WebAssembly Interface Types (WIT). It's basically a ABI layer for wasm. This is a pre-requisite for host-object bridging, bringing in things like DOM elements.

Long running effort, but it's hard work and there's just not that many hands available for this deep work. Some assorted links with more: https://github.com/WebAssembly/component-model https://www.fermyon.com/blog/webassembly-component-model https://thenewstack.io/can-webassembly-get-its-act-together-...

A preview-2 should be arriving sometime somewhat soon.

It's just hard work. It's happening. And I think the advantages Andy talks to here illuminate very real reasons why this tech can be useful broadly. The ability to have plugins to a system that can be safely sandboxed is a huge win. That it's in any language allows much wider ecosystem of interests to participate, versus everyone interested in extending your work also having to be a java or c++ or rust developer.

Re:Missing the Point of WebAssembly by davexunit on Tuesday January 09, 2024 @03:12PM (#38931397)
The type system introduced in Wasm GC allows sharing data between the host and other modules and is usable right now. DOM access is possible and being demonstrated in several language implementations.
Re:Missing the Point of WebAssembly by schemescape on Tuesday January 09, 2024 @04:30PM (#38932377)
I saw you mention this in a previous post, but I can’t find an example. Do you have one handy? What are the limitations?

Edit: is this it? https://www.spritely.institute/news/building-interactive-web...

Edit again: apparently I had seen this before, since I upvoted its HN submission. Oops! https://news.ycombinator.com/item?id=38477602

Re:Missing the Point of WebAssembly by davexunit on Tuesday January 09, 2024 @04:37PM (#38932467)
Yup, that's one of the examples! And here's another: https://spritely.institute/news/scheme-in-scheme-on-wasm-in-...
Re:Missing the Point of WebAssembly by singularity2001 on Tuesday January 09, 2024 @03:17PM (#38931475)
are you sure? the last time I checked JavaScript was NOT able to access Wasm/GC objects
Re:Missing the Point of WebAssembly by paroneayea on Tuesday January 09, 2024 @03:35PM (#38931730)
Yes, we have made use of JS invoking WASM-GC managed Scheme objects in our Hoot demos at Spritely.
Re:Missing the Point of WebAssembly by singularity2001 on Tuesday January 09, 2024 @03:44PM (#38931840)
In Chrome 120 I still get:

TypeError: WebAssembly objects are opaque

When trying to read/write WASM-GC objects in JS.

Re:Missing the Point of WebAssembly by titzer on Tuesday January 09, 2024 @05:04PM (#38932863)
Wasm modules have been able traffic in (opaque) host references since the reference-types proposal landed several years back.
Re:Missing the Point of WebAssembly by davexunit on Tuesday January 09, 2024 @05:14PM (#38932994)
But GC ref types have made it practical.
Re:Missing the Point of WebAssembly by logicprog on Tuesday January 09, 2024 @10:22PM (#38935728)
> While I don't necessarily agree with the unnecessary, unsupported, casual, & cheap (provided with zero substantiating/contestable support)

What I personally find annoying is the debate-bro attitude that expects every statement anyone makes that you disagree with to be made with an entire supporting argument with multiple examples or citations, especially when the general reasons someone might believe that statement are pretty well known. And expressing their opinion on thr quality of JS wasn't unnecessary, it was literally necessary to explain why they are excited for the potential of WebAssembly.

> contempt culture

Oh that essay. Thinking a technology is bad and stating so, even making fun of it a bit, is not inherently mocking or degrading the skills or legitimacy of the people that use it. The author of that essay was right we shouldn't mock or degrade the skills (or other aspects) of anyone, but they can't seem to realize that making fun of a language isn't tantamount to mocking the people that use it, and if someone feels that's the case, maybe they should learn to separate their ego / sense of self worth from the tool they use, so we avoid language or editor flame wars by way of greater maturity, instead of by way of walking in eggshells. Especially since languages can be better or worse. Seeking a kinder, more inclusively spirited community is commendable, but expecting every opinion about language quality to be either kept in or perfectly sourced is a blind and misplaced excess of enthusiasm in that direction. And I say this as someone who supports things like DEI and CoCs.

For myself, I think JavaScript has a lot of warts, but not really any more than a lot of popular languages, and the core of it is very well designed indeed, but I just personally don't prefer to use it. Just in case you were going to assume I'm responding this way because I want to be able to make fun of JS. I don't. I just find this style of thinking annoying.