Live data from Hacker News

Clang runs in the browser and compiles C++ to WebAssembly

tbfleming.github.io

141–150 of 318 posts

Re: Clang runs in the browser and compiles C++ to WebAssembly

#142

Next we'll get to a webassembly-only VM that will replace the OS. All 'apps' will run on this VM instead of being native, and most will be cross platform. They'll talk to each other via messaging (using Javascript semantics) instead of bytes-over-pipes as they do today. An integrated globally available, namespaced data store API might replace the filesystem. Each app+version will be accessible by a distinct URL. 'My…

Replace “WebAssembly VM” with “JVM” and you will see how it’s already available, and why it won’t catch on.

JVM had to be installed, and it was far from seamless the way OP describes it.

The advantage of wasm is that all the people running Chrome today already have it.

Re: Clang runs in the browser and compiles C++ to WebAssembly

#143
post #13
post #2

So Clang itself was compiled to WebAssembly? That's slick, even if it does take forever to load.

What about packing up web assembly into a single file container like runtime designed to run server side web applications? This .war (Webassembly ARchive) file could include the application and all dependencies in a single installable that is JITd on load. Might be useful for the next generation of "serverless" cloud runtimes.

>.war (Webassembly ARchive)

This is sarcasm, right? If it is, it's damn good.

Re: Clang runs in the browser and compiles C++ to WebAssembly

#144
post #7

Earlier quoted context omitted.

Isn't WebAssembly a VM inside browser ? If so, I am skeptical especially with end of moore's law. Edit: I was a bit mis-informed, the design document is an interesting read.. https://github.com/WebAssembly/design/blob/master/Rationale....

It is a VM, stack-based like the JVM. It is called a "WebAssembly VM" in the document.

Unlike JVM, though, it has semantics that make it possible to compile to optimized native code easily, without having to do complicated analysis for more advanced optimizations.

Re: Clang runs in the browser and compiles C++ to WebAssembly

#145
post #35

Earlier quoted context omitted.

It's definitely possible but we went through all of this a decade ago with Adobe Air, Microsoft Silverlight, and JavaFX. Nearly a decade before that, in the early 2000s, we went through this with Macromedia Flash, Java Applets, and Microsoft ActiveX. Trying to replace native applications with runs-in-the-browser RIAs is nothing new, but we're at least finally agreeing on the language/implementation, so maybe this tim…

I'm not sure why you are down voted as all that is true and easily verified.

It's not comparable for one simple reason - all the listed techs worked in the browser, but they didn't come with the browser (or, at least, with all browsers). WebAssembly does - and because most browsers auto-update these days, users get on the bandwagon without doing anything at all.

Re: Clang runs in the browser and compiles C++ to WebAssembly

#147

Next we'll get to a webassembly-only VM that will replace the OS. All 'apps' will run on this VM instead of being native, and most will be cross platform. They'll talk to each other via messaging (using Javascript semantics) instead of bytes-over-pipes as they do today. An integrated globally available, namespaced data store API might replace the filesystem. Each app+version will be accessible by a distinct URL. 'My…

Replace “WebAssembly VM” with “JVM” and you will see how it’s already available, and why it won’t catch on.

[deleted]

Re: Clang runs in the browser and compiles C++ to WebAssembly

#148
post #80

Earlier quoted context omitted.

Unity also has the slight delivery hitch of needing the browser plugin to run games in the browser. I tinker with Unity and I still didn't install the browser plugin. That is the same hitch the JVM had. For a non-technical user, that extra step feels risky and unintuitive. "Why doesn't it just work?" feels a bit unfair when you know what's going on, but to a normal user I think it's a fair question. We are the profes…

Yes. Please, someone, make gamedev in the browser a reality. There are a thousand hitches: Why can't I install a 9GB game on the browser? We need all that space for textures. "But what if –" Oh come on, we can figure it out. There must be some way. Also UDP. Yeah, we have WebRTC, but look up Beej's guide to network programming. That's the threshold of intelligence required. Currently to get WebRTC working with UDP fo…

I've written a library for that purpose [1]. It's not ideal, but I guess it's as close as you can get to UDP in a browser without using extensions.

[1] https://github.com/seemk/WebUDP

Re: Clang runs in the browser and compiles C++ to WebAssembly

#149
post #80

Earlier quoted context omitted.

Unity also has the slight delivery hitch of needing the browser plugin to run games in the browser. I tinker with Unity and I still didn't install the browser plugin. That is the same hitch the JVM had. For a non-technical user, that extra step feels risky and unintuitive. "Why doesn't it just work?" feels a bit unfair when you know what's going on, but to a normal user I think it's a fair question. We are the profes…

Yes. Please, someone, make gamedev in the browser a reality. There are a thousand hitches: Why can't I install a 9GB game on the browser? We need all that space for textures. "But what if –" Oh come on, we can figure it out. There must be some way. Also UDP. Yeah, we have WebRTC, but look up Beej's guide to network programming. That's the threshold of intelligence required. Currently to get WebRTC working with UDP fo…

> Yes. Please, someone, make gamedev in the browser a reality.

I think gamedev in the browser is a reality, but it requires two things:

1. Familiarity with Web/OpenGL.

2. Familiarity with well-written Javascript.

Those two camps are typically not the same crowd...

There's a transition period that comes from writing dom-based UI controls into WebGL- and this scares off a lot of solid js developers.

Similarly, there's a transition period that comes from writing C# or C++ into clean JS on the level that games require (e.g. where messy code has a huge impact on development speed and sanity). For example, I think well-written javascript looks more functional than object-oriented. That point could start a flame-war of its own, but we can all agree that the JS in the wild is often messy as hell.

This assumes that JS is the language the game is written in at its core... tbh I don't see WebAssembly replacing this part anytime soon... I see C->WebASM more for like helper utilities. For example, it would be great for a tool to generate geometry for line drawing, rather than manage the logic of when and where to draw the line due to mouse events.

As more people start to glue these sides together, I think we'll see some really cool stuff on the web. Maybe even as cool as the full-flash Away3D type sites we had 10 years ago :P

Re: Clang runs in the browser and compiles C++ to WebAssembly

#150
post #41

So the web browser is pretty much a mini operating system. Firefox and Chromium seriously feel like they have the longest compile time out of any package in Gentoo, except maybe Libreoffice. It has tons of embedded packages that it doesn't pull from the system/native (jpeg and png decoders and such). So with a lot of these neat things where we compile stuff or run a Linux kernel in the browser, we've pretty much come…

I have been thinking about why we have ended up here, and why not just native apps. The obvious answer is that it makes applications portable, which is great. The other key component I think is delivery. You don't ever install anything, it just exists when you ask for it. That is something native applications have never done, and not even something like JVM has done even though it addresses portability too. It is als…

> You don't ever install anything, it just exists when you ask for it

Relevant XKCD:

"Installing" https://xkcd.com/1367/

Post reply on HN