Live data from Hacker News

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

tbfleming.github.io

71–80 of 318 posts

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

#71
post #22

Idea - make a website that lets you compile and test any open source program. For example, I should be able to clone, compile, and run gedit (a stagnating text editor included with many linux distros). This would let me quickly experiment with and edit a variety of programs and tools within the web browser without needing to get a development system up and running. I bet open source projects can get a ton of new hack…

Isn't this what containers do?

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

#72
post #41

Earlier quoted context omitted.

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…

Most users spend >80% of their time in the browser. It's probably that simple. If you have a thing and you need users, are you really going to deliver it as a Qt app? Unless you're bitcoin, it's hard to think of a case. I'd say "or a game," but many are webapps. And at this point some of the hollywood-grade games might figure out a way to be coming to browsers soon. Unreal did it.

I agree, they are in the browser and they searched for the software in the browser. Why not deliver it in the browser too, if there is no good reason not to.

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

#73
post #10

I guess this just means we’re one step closer to Gary Bernhardt’s vision: https://www.destroyallsoftware.com/talks/the-birth-and-death...

Every time something like this is posted, I always think of that video.

As ridiculous and played-for-laughs as it is, it's looking more and more accurate (in one form or another) every day.

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

#74

Earlier quoted context omitted.

I haven't looked much into WebAssembly, but regardless of the native language that you use, your app will be cross-platform without having to put any extra effort, won't it? This solves one of the biggest pain points of native GUI development. While it's pretty amazing what QT has managed to accomplish, I still hear incompatibility problems between OSs.

It "solves" it by not solving it - WebAssembly doesn't do UIs, that component is still built in HTML. The wasm functions are just doing the expensive computation. I think there's been some work to build DOM apis in languages that compile to wasm, but for the most part the workflow is to create your UI in markup or standard javascript and then call out to wasm functions to do things, or else building the UI in WebGL (…

And that's how it solves an additional problem.

You don't have a GUI toolkit pre-defined if you start out with c++ (yes, it takes freedom, but gives ease of development, which seems to be today's currency).

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

#75

People might not like it but i really think native apps are going to die once everyone figures out how to optimize this crazy web stack.

I disagree. When people start using native languages like C++ for the Web, they will quickly realize they could have just used C++ to begin with.

I was going to say this is just for portability for average consumer facing applications you need shipped as easily as possible, but actually I've seen people developing "native" extensions for Node.js with WebAssembly.

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

#76
post #30
post #22

Idea - make a website that lets you compile and test any open source program. For example, I should be able to clone, compile, and run gedit (a stagnating text editor included with many linux distros). This would let me quickly experiment with and edit a variety of programs and tools within the web browser without needing to get a development system up and running. I bet open source projects can get a ton of new hack…

Main issue is memory usage. Running KDE+Kate - http://vps2.etotheipiplusone.com:30176/redmine/emscripten-qt... - uses 1793MB (htop VIRT), 416MB (Chrome task manager). (Oh, and the renderer process wasn't hosting any other tabs.) Second main issue is speed. qsterix isn't as memory-heavy but runs all Tetris game code inside KDE JavascriptCore, which as part of the KDE/Emscripten build is transpiled to JS. In other word…

Download of normal Kate hangs for me, too. But the noicon variant works well. However, I don't get a keyboard for text input (Chrome on Android/HTC10). So, well, sorry to disappoint you :P

While Kate is already quite funny, I'm looking forward to someone porting Linux to the browser, so we can have a clientless desktop environment delivered from a serverless cloud ;) I really want to run vim/g++ in a terminator on KDE on Linux on my phone connected to a keyboard+screen (once, for the laughs).

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

#77

Earlier quoted context omitted.

Really this just points to a lack of vision on the part of operating systems people. There is no reason downloading, possibly "installing" (mostly caching?) and running "traditional software" couldn't be as frictionless as clicking on a link, but that's just not how the software and security model of Windows, OSX or Ubuntu (to name just the household names) are set up. Browsers probably will win, but mostly by accide…

It's not either/or. The browsers will probably eventually be integrated into the OS until they are almost invisible. All apps will be web apps.

I hope the browser will be invisible soon, because I hate having it between me and my application.

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

#78

Earlier quoted context omitted.

I haven't looked much into WebAssembly, but regardless of the native language that you use, your app will be cross-platform without having to put any extra effort, won't it? This solves one of the biggest pain points of native GUI development. While it's pretty amazing what QT has managed to accomplish, I still hear incompatibility problems between OSs.

It "solves" it by not solving it - WebAssembly doesn't do UIs, that component is still built in HTML. The wasm functions are just doing the expensive computation. I think there's been some work to build DOM apis in languages that compile to wasm, but for the most part the workflow is to create your UI in markup or standard javascript and then call out to wasm functions to do things, or else building the UI in WebGL (…

> WebAssembly doesn't do UIs, that component is still built in HTML

Your UI could be HTML, but equally it could be a WebGL-based UI. Some UI libraries already use OpenGL as a backend so adding support for a WebGL backend shouldn't be too hard.

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

#79

Earlier quoted context omitted.

Really this just points to a lack of vision on the part of operating systems people. There is no reason downloading, possibly "installing" (mostly caching?) and running "traditional software" couldn't be as frictionless as clicking on a link, but that's just not how the software and security model of Windows, OSX or Ubuntu (to name just the household names) are set up. Browsers probably will win, but mostly by accide…

I've been thinking lately there should be a file format that's just WebAssembly along with WebAssembly-versions of WebGL, Web Audio and WebRTC. With the goal of making the runtime simpler to implement for non-browser venders. While browser vendors could add a profile to run the format.

... or to just load it up in the browser and skip the HTML part. Non-browser vendors will probably have to integrate browsers.

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

#80

Earlier quoted context omitted.

Most users spend >80% of their time in the browser. It's probably that simple. If you have a thing and you need users, are you really going to deliver it as a Qt app? Unless you're bitcoin, it's hard to think of a case. I'd say "or a game," but many are webapps. And at this point some of the hollywood-grade games might figure out a way to be coming to browsers soon. Unreal did it.

It is that simple. And a bummer because I think HTML is a pain for things that aren't documents. And JS UI frameworks feel like hacks too. Unity already supports the web, but I don't think that'll matter for AAA games. People who buy computers specifically to play them will care about the slight performance hit and not want to keep the games they bought and spend a lot of time with as bookmarks to web pages. Non-perf…

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 professionals after all, why can't we make it "just work"?

Post reply on HN