News for hackers. Stuff that matters.
Re:WebAssembly Interface Types: Interoperate with All the Th... by duxup on Wednesday August 21, 2019 @01:01PM (#20759088)
I'm gonna go out on a limb here and expose my n00bishness, and honestly a lot of that article has my head spinning as I google a lot of terms ;)

I've only done web development for a year now and I've seen some cool WebAssembly demos but mostly those are demos of various frameworks (or no framework) reusing random WebAssembly components.

It's cool, but I'm missing from a large web application stance how WebAssembly is supposed to work, specifically when it comes to stuff like you see in some frameworks with state management across components and etc. Is there an example of that?

Re:WebAssembly Interface Types: Interoperate with All the Th... by vcarl on Wednesday August 21, 2019 @01:06PM (#20759125)
Web assembly is generally an optimization, not an app alternative. Think of it the way you would the C bindings Node.js has. If you've got a compute-heavy code path, writing it in C (or Rust etc) and shipping it as web assembly could be a dramatic perf improvement, but there's not really a substantive benefit to writing your entire app with it.
Re:WebAssembly Interface Types: Interoperate with All the Th... by asdkhadsj on Wednesday August 21, 2019 @01:23PM (#20759262)
> but there's not really a substantive benefit to writing your entire app with it.

Amendment: Perhaps it's debatable what "substantive benefit" would be, but writing the whole app in it is a huge benefit if you really want to do that. That is to say, for years people wanted to write Web UI stuff in various languages, this also allows for that.

So while the concrete performance boost may not be meaningful in writing an entire web app in C, Rust, Go, Python or w/e - to the developer happiness the boost may be huge for those devs that want it.

Re:WebAssembly Interface Types: Interoperate with All the Th... by vcarl on Wednesday August 21, 2019 @01:50PM (#20759540)
Well, you still can't do that—WASM doesn't have DOM bindings, you'd still have to ship out to JS. I believe that's a goal, so yes eventually that could be a benefit, but not at the moment.
Re:WebAssembly Interface Types: Interoperate with All the Th... by asdkhadsj on Wednesday August 21, 2019 @02:00PM (#20759657)
Fwiw, you can - just perhaps with not pure WASM and perf.

My next app I'm planning on using a Rust WASM DOM framework, and I know there are some in Go as well. This is primarily for developer UX.

Re:WebAssembly Interface Types: Interoperate with All the Th... by pjmlp on Wednesday August 21, 2019 @02:32PM (#20760061)
DOM bindings are kind of irrelevant when one has WebGL.

One example among many ramping up

https://platform.uno/

Re:WebAssembly Interface Types: Interoperate with All the Th... by the8472 on Wednesday August 21, 2019 @02:52PM (#20760317)
Rendering UIs in webgl is fairly user-hostile. No accessability, no extensions, no custom styles, ...
Re:WebAssembly Interface Types: Interoperate with All the Th... by pjmlp on Wednesday August 21, 2019 @03:51PM (#20760976)
Yes it keeps coming up, yet Flash will have its revenge.
Re:WebAssembly Interface Types: Interoperate with All the Th... by mrec on Wednesday August 21, 2019 @02:46PM (#20760252)
For a smallish subset of use cases, maybe. But replacing the DOM with a canvas-based UI for general use would be reinventing many of the problems of Flash.
Re:WebAssembly Interface Types: Interoperate with All the Th... by pjmlp on Wednesday August 21, 2019 @03:53PM (#20760998)
Many designers and game devs see it otherwise.
Re:WebAssembly Interface Types: Interoperate with All the Th... by TeMPOraL on Wednesday August 21, 2019 @05:04PM (#20761826)
Gamedev is a separate topic. As for designers, they are on the opposite side from users in the tug-of-war of control over content rendering. I don't believe they should get 100% of their way.
Re:WebAssembly Interface Types: Interoperate with All the Th... by mrec on Wednesday August 21, 2019 @05:57PM (#20762287)
Gamedev falls squarely into my "smallish subset of use cases". It does legitimately need non-DOM UI, but it's not a huge part of the Web (yet).

As for designers, thank you for finding a much more diplomatic phrasing than the one I was about to write.

Re:WebAssembly Interface Types: Interoperate with All the Th... by Rusky on Wednesday August 21, 2019 @05:20PM (#20761956)
WebGL bindings are on the same footing as DOM bindings- they're not an alternative in this sense, because insofar as we have one we already have the other.
Re:WebAssembly Interface Types: Interoperate with All the Th... by pjmlp on Thursday August 22, 2019 @01:11AM (#20764835)
No because accessing WebGL contexts directly from WebAssembly, specially WebGPU ones, is something that keeps coming up in some Chrome presentations.

And thanks to many, including HN readership, Chrome and Safari are the only browsers that many businesses care about nowadays.

Re:WebAssembly Interface Types: Interoperate with All the Th... by Rusky on Thursday August 22, 2019 @12:59PM (#20770149)
What I'm saying is, the feature/mechanism that lets WebAssembly call WebGL or WebGPU is exactly the same one that lets it call DOM APIs. The same implementation work supports both.
Re:WebAssembly Interface Types: Interoperate with All the Th... by icebraining on Wednesday August 21, 2019 @03:18PM (#20760587)
I looked into their WebAssembly demo, but it doesn't seem to use WebGL, just a regular DOM (with an ungodly number of elements).
Re:WebAssembly Interface Types: Interoperate with All the Th... by pjmlp on Wednesday August 21, 2019 @03:52PM (#20760990)
That was just an example, maybe not the best one.

I should just have linked something done in Unity instead.

Re:WebAssembly Interface Types: Interoperate with All the Th... by miguelrochefort on Thursday August 22, 2019 @03:28AM (#20765522)
Uno uses DOM bindings, not WebGL.
Re:WebAssembly Interface Types: Interoperate with All the Th... by opencl on Wednesday August 21, 2019 @01:19PM (#20759221)
Another benefit is initial page load times, if your page has a lot of JS it can take a pretty significant amount of time to parse it.

i.e. Figma said it reduced page load times by a factor of 3, though they were using WASM to replace existing asm.js code.

https://www.figma.com/blog/webassembly-cut-figmas-load-time-...

Re:WebAssembly Interface Types: Interoperate with All the Th... by petters on Wednesday August 21, 2019 @01:11PM (#20759158)
Another benefit I suppose is that you can choose from many more languages. Whether that is substantive or not depends on the person, I guess.
Re:WebAssembly Interface Types: Interoperate with All the Th... by weberc2 on Wednesday August 21, 2019 @01:14PM (#20759181)
That's a use case, but there are many others, as the article mentions, like lightweight isolation for server side apps or writing your frontend app in a different language (not pragmatic today, but could be in the future).
Re:WebAssembly Interface Types: Interoperate with All the Th... by Juliennng on Wednesday August 21, 2019 @01:33PM (#20759363)
Maybe that article can help about real world use case : https://tech.ebayinc.com/engineering/webassembly-at-ebay-a-r...
Re:WebAssembly Interface Types: Interoperate with All the Th... by duxup on Wednesday August 21, 2019 @01:37PM (#20759405)
Thank you.