I work exclusively as a DevOps/DataOps/Backend engineer and have little contact with stuff running in the browser. I did, however, work with AngularJS back in the day, and although the framework itself didn't lend itself to nicely to productivity and simplicity, I believe that what I found most confusing was how unergonomic the browser environment itself was, from not dealing with a filesystem (and thus having to resort to tricks like transpiling and bundling) to the rather terse API, not having for instance a SQLite natively and not being able to enable something like this without bringing copious amounts of megabytes of extra javascript deps...
Is the browser environment becoming more dev-friendly with the adoption of WebAssembly? I ask that because, in my opinion, if the browser itself doesn't evolve, it doesn't matter which language we use, interacting with it will still be a hassle. All in all, it feels like the browser advanced a lot in technology for optimization and resource management, but not so much in becoming more user-friendly to the developer.
We had this for a brief moment in the form of Web SQL, but as a rule web standards require independent implementations to be developed, and all the implementors were using SQLite under the hood. The current alternative is IndexedDB - for better or worse.
> Is the browser environment becoming more dev-friendly with the adoption of WebAssembly?
Yes, but that doesn't have much to do with WebAssembly.
JavaScript as a language evolved, we have TypeScript with its flexible and expressive type system and bundling is becoming less of a pain with each consecutive framework re-written using ES2015 modules(and loaded via e.g. Snowpack https://www.snowpack.dev/).
WebAssembly is helpful when there's a need for some heavy lifting - e.g. in software codecs, but that's still a niche application.
If WebAssembly replaced js, then newer, more efficient browser languages could be invented. Like a new implementation of typescript could be created that is statically compiled and more efficient. All of this transpiling from x to js and y to css would be unnecessary.
But it's going to be a very "heavy" custom framework that takes time to download and load. Overkill in most cases.
WebGL is a type of HTML5 canvas context. Unfortunately, there are major drawbacks which I also outlined - it's too low level and loses platform consistency, accessibility, usability, and really every affordance of an operating system - you're starting over from scratch and loading in dependencies or writing your own implementation of some immensely challenging concepts (font rendering on its own is usually several hundred kb of code and could fill textbook upon textbook).
If you're familiar with GL UI frameworks like dear-imgui, they do all work pretty well in WebAssembly. But again, they're compromised from the start because you lose all OS consistency and accessibility. And unlike in games, where these frameworks are often employed, OS consistency isn't expected, and accessibility is sadly ignored, the experience of a cross-platform UI framework appearing in a canvas element on the web becomes jarring very quickly.
There is an alternative approach, like Google Docs employs and the sibling poster linked - combining the DOM for input elements with custom rendering. But, this is really, really complex and challenging.
Every time I develop applications for the web, I yearn for an application-focused presentation layer which provides the expected fundamentals around accessibility, OS consistency, and rendering layout while ditching the hacks-on-hypertext minefield of CSS and the DOM.
However I do see the appeal of the ergonomic of the TypeScript syntax. I hope TC39 will add something like optional type annotations to the spec.
tbh i haven't checked, but isn't the transpilation step for typescript just stripping out the type annotations? TSC is build-time only, so it won't factor into your bundle size, and i can't imagine the generated JS is significantly bigger than source -- if anything, it should be smaller ;p
[0] https://dev.to/haruanm/does-typescript-increase-the-bundle-s...
I would guess running the TypeScript output through the Google Closure compiler (or adding similar optimizations directly to the TypeScript compiler) could make TypeScript bundles comparable to JavaScript bundles or smaller. It looks like people see significant improvements running TypeScript output through Closure compared to just WebPack [0].
[0]: https://medium.com/appmonet/using-closure-compilers-advanced...
Does the web browser (an application for reading documents written in hypertext), need to evolve? Or, has the web browser been asked to do more than it should and we need a new type of application? So much of the internet is based around the fact that the basics of the web browser can't change (don't break the web!). If the basics can't change then maybe the need for a new standard where the basics fit the application is required.
If I had a magic wand,
- I'd make Web maximally interoperable, give an API to everything: look up Youtube recommendations or listen to Spotify programmatically or from the command line;
- introduce legislation to forbid non-interoperable for-profit (or infrastructure-level) software; otherwise businesses are incentivized to make walled gardens and lock-in users; e.g. no more countless chat apps;
- get rid of Javascript: it creates too many security and fingerprinting problems, and, if everything has an API, you don't need it;
- break up the browser into a composition of smallest independent components possible; it will get you `apt install facebook-local-events`;
- get rid of password-based authentication: what a horrible idea that was;
- get rid of any client-side possibility to track or fingerprint users; if you're making choices about what services to use or how, those choices can be fingerprinted, depending on some other things, but that's another matter; the other party should not be exposed to what hardware or software or configuration you use or how you use your peripherals;
- introduce consumer and competition protection laws to bring software out of the wild wild west in terms of legislation.
I've more or less described the destruction of Web as we know it, but also a creation of something much better, in my eyes. Doesn't sound very feasible, but that's what I'd do if I had a magic wand.
Blazor, Unity, Uno, Qt, TeaVM, the list is only getting bigger and it will only stop if WebAssembly is removed from the browsers.
Pandora box is open and the lid won't close.
Web Assembly isn’t going to get rid of the sandbox.
Sandbox doesn't imply not having a file system available (for example, for use in imports), I believe this is more of a historic limitation than a strictly technical one (just because we need the sandboxing concept).
I know. Fakeroot is not strictly sandboxing, but I think it illustrates the point.
Pyodide is used in https://jupyterlite.readthedocs.io/
Maybe things will improve with web assembly GC, though it will require work to port GC languages to it.
Saying that I am really interested in Webassembly and think the word web in Webassembly does it a disservice.
I have started to think of Webassembly as a light weight JVM. It's heavy sandboxing makes it really interesting as an evolution to FaaS (Function as a service) such as AWS Lambda. Lucet which Fastly is using for their Compute@Edge reports 35 micro second code start time! I can't wait until Fasly put there Compute@Edge on general release so I can try it. I've been playing with Cloudflare workers and as they us Chrome to run WASM files you have to mess about writing Javascript shims so a bit rough around the edges debugging.
Webassembly should realise the original goals of serverless providing a cross platform runtime with security guarantees and be fast and lightweight.
Most people package an entire OS in Docker containers, with WASM they get a small cross platform artifact. This project already looks like a way to run them in K8s https://github.com/deislabs/krustlet.
It also looks great for cross platform media devices. Have the bulk of your code as a WASM binary and then have very thin platform specific shim the WASM interacts with.
WebAssembly provides an amazing opportunity to do general computing in webpages more efficiently than with the JavaScript scripting language, but it's not designed to interact directly with the user or documents. Certainly that _could_ change in the future, but that's not one of its design goals and I don't think it would even be particularly effective at it.
The existence of both sentiments speaks to the idiosyncratic history of the web. The browser is powerful because it has grown to be ubiquitous, but also has this odd dual mandate of displaying static content and running dynamic apps.