Live data from Hacker News

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

tbfleming.github.io

181–190 of 318 posts

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

#181
so does the concept of the 'browser is the OS' , improve security? Is it analogous to a hypervisor running on a server somewhere, then when you log into the server, it spins up a vm os just for you. Now any hacking done on that os is isolated and disappears when that instance is closed. in the same way, when the browser is the os, none of the files,apps or stuff on your machine is available to it?

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

#182
post #139

Earlier quoted context omitted.

The answer is that browsers provide something that users desperately need and no operating system has ever provided: a sandbox strong enough to run completely untrusted code. The success of browsers is an indictment of the entire field of operating systems research. They have either failed to recognize the need or simply failed to deliver that kind of security. For one example take WebGL. For decades OpenGL had been…

> a sandbox strong enough to run completely untrusted code No browser has provided that either. In fact, browsers are by definition a security anti-feature because they are always connected to the network and the customer/user data lives on the network. Even if they manage to solve the problem of computers getting hacked when visiting websites they are very unlikely to solve the problems of tracking and private data…

I've been using the web for over twenty years and it has never harmed my computer or invaded my system in any way. I do think I've seen adware and scumware that may have originated on the web on friends computers but I'm pretty sure they did something like allow a toolbar to be installed. Can you give an example of an exploit that did not require user permission,did not use a plugin, and that allowed arbitrary code execution from the internet ?

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

#183

Earlier quoted context omitted.

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.

> but equally it could be a WebGL-based UI

Then you might as well ship a native binary. Beyond cross-compilation and window system bindings, there aren't many more portability concerns. But then you're rebuilding the browser, so the question is whether you can do it better than Google/Microsoft/Apple by including only the truly necessary bloat for your use-case. Bonus: you get to avoid browser politics.

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

#184
post #117

Earlier quoted context omitted.

Can you point me to them? Thinking about using HTML to build an app with good UX lets magic smoke leave my head.

Qt should work.

Qt solves almost the same problems as a browser, all it's missing is sandboxing and fetching resources over the network.

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

#185
post #46

Earlier quoted context omitted.

Getting people to download and install traditional software is a substantial point of friction. Average users hate managing software installations, updating, fixing broken installations, dealing with malware, et al. The problem spans from the enterprise down to normal consumers. Browsers as a better software platform, will significantly accelerate the rate at which software eats everything. Most software should ideal…

App stores will solve most of this, if they haven't already.

Yeah, except for that 30% of your revenue vanishing.

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

#186

Earlier quoted context omitted.

It also makes it hard to pirate your software. Cracking native software is relatively trivial which is why legitimate licenses cost insane amounts. Contrast soundtrap charging $15 a month for their web based DAW to Ableton having to charge $750 to make up for piracy costs.

On the flip side of that coin, as a user, it also makes hard to control your own software - you are not in control of the version you are using, not in control of the features the program has and above all not in control of the availability of that program as whoever owns the server you are accessing it from can revoke that access at any point for whatever arbitrary (but of course always mentioned in the Terms and Co…

That assumes it would be impossible to download a WASM blob and run it natively, or that no one will ever provide source code for their binaries which you could potentially edit. It's not a zero-sum game.

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

#187

Having some random thoughts about the comments here, some of which talk about having a "browser" drive large parts of what we consider today an "operating system". I agree that certain aspects of what most modern operating systems do today can be abstracted away behind a unified, convenient (and perhaps browser-accessible) API. The entire user-experience stack comes to mind immediately, but there are counter examples…

I think it just happens that browser is the most widely installed VM independent of a single major vendor, pretty cross-platform and with enough features to build applications of any complexity. If you would design that from scratch, I think that something much simpler could be designed, much simpler than JVM, for example. But how would you install it to every computer out there? Nobody would use it if it's not installed everywhere.

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

#188

Having some random thoughts about the comments here, some of which talk about having a "browser" drive large parts of what we consider today an "operating system". I agree that certain aspects of what most modern operating systems do today can be abstracted away behind a unified, convenient (and perhaps browser-accessible) API. The entire user-experience stack comes to mind immediately, but there are counter examples…

Well, what would you have replace it?

Like most things that become very popular, the web is becoming an os-like platform because it solves a problem. Putting your application at a URL is hugely more accessible than asking someone to download something. Maybe not to us HN readers, but to my mom, who's skeptical to a fault of anything that says download, it's huge.

HTML+CSS+JS is everywhere and complete in a way that literally nothing else is. Yeah C is everywhere but (before nowish) you couldn't write a C application once and have it run the same pretty much everywhere.

But chuck, you say, HTML has notoriously bad compatibility and working with it is frustrating. I propose to you that HTML and CSS have so many compatibility problems because of how pervasive it is and has been for so long, and how many different implementations of it exist. Anything is bound to develop compatibility issues when it gets as large as the web.

But you're right, it's suboptimal and other tech has tried to be everywhere. Java and Flash did try, but have you ever used a java applet? They're fine I guess, but they're stuck in a square on the page. You can make a java or flash object take up the whole page and completely control the website but then you run into accessibility issues and complexity on your part.

Javascript has grown organically over the past decades for a reason, and it's being used in this fucked up way because, all things considered, it's the best platform for the job right now

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

#189
Impressive as it is, depressing that it enables C++ survival. C++ is a badly designed mess that gets ever more complicated and most probably the language itself is order(s) of magnitude complex than the problem you're trying to solve. Please enable other better designed comparable languages (like, D,Rust,Nim,etc..)

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

#190
post #186

Earlier quoted context omitted.

On the flip side of that coin, as a user, it also makes hard to control your own software - you are not in control of the version you are using, not in control of the features the program has and above all not in control of the availability of that program as whoever owns the server you are accessing it from can revoke that access at any point for whatever arbitrary (but of course always mentioned in the Terms and Co…

That assumes it would be impossible to download a WASM blob and run it natively, or that no one will ever provide source code for their binaries which you could potentially edit. It's not a zero-sum game.

I believe we have already enough evidence, both by the existing web applications and by the other RIA technologies available over the years (Applets, Flash, Silverlight, ActiveX, etc) that this is a very safe assumption to make. There are exceptions to this, of course (i myself made the source code of my 3D engine for Flash written in Haxe available years ago), but those are extremely rare.

Besides the experience the original GP post was talking about and the message i replied to didn't really leave any room for not making such an assumption since they were all about comparing web apps to native apps: " I have been thinking about why we have ended up here, and why not just native apps."

And finally, i do not see WASM being of giving any more control to the user than existing web tech - after all it relies on the rest of the webpage to work, much like JavaScript (actually, it does require JavaScript to act as a mediator - at least for the time being) and considering how you cannot download Google Docs as a native offline application to use on your desktop, despite being able to save locally the JavaScript it downloads on your browser, i fully expect to be the same situation with WASM too.

Post reply on HN