7 ms·
I'm partially worried about WebAssembly. On one hand it opens up new possibilities... on the other hand, due to backwards compatibility I think that the future
by oblio 9y ago
I'm partially worried about WebAssembly. On one hand it opens up new possibilities... on the other hand, due to backwards compatibility I think that the future will look like this:
- 1 browser tab: Java runtime environment compiled to WebAssembly, loaded by some sort of enterprise app I'll have to use at work
- another browser tab: .NET BCL compiled to WebAssembly, loaded by another sort of enterprise app I'll have to use at work
- yet another browser tab: some sort of other C/C++ runtime compiled to WebAssembly, loaded by fancy site, let's call it XMail
- and yet another browser tab: another C/C++ runtime loaded by another fancy site, let's call it Ywitch
- a million other tabs with Javascript frameworks
From a certain point of view diversity is good, on the other hand there's so much fragmentation. One of the dreams when computers appeared was that programmers will build libraries that everyone will use and people would just build on top of these libraries, reaching ever higher.
Instead, we have I don't know how many re-implementations of things in various incompatible/slightly incompatible languages. And that's just for OSS, nevermind the billion proprietary re-implementations.
Truly the Tower of Babel.
As bad as Javascript is generally considered, from this philosophical point of view at least we seemed to be on the right track...
- bigato 9y agoJust as it is in the desktop: you have loads of languages, libraries and runtimes. I don't really see the problem with the same happening on the web. If there is openness to diversity, chances are higher that quicker evolution will happen over time.
- coldtea 9y ago>Just as it is in the desktop: you have loads of languages, libraries and runtimes. I don't really see the problem with the same happening on the web It's already bad on the desktop -- from duplication of effort, to crappy cross-platform options. On the web it will be much worse -- each open wasm tab will eat half your battery in an hour.
- shubb 9y agoIt's surprising how big programs are. Very basic android apps can weigh in at 30-60mb, and I've noticed cordova apps are particularly bad for that. Imagine needing to pull that much data every time you visited a new site. We're already seeing this weird situation where websites that are perfectly usable in urban areas become impossible to use in the mountains. Urban telcom networks can be upgraded to make a 60mb runtime feel reasonable, but a lot of rural networks don't even work for todays sites.
- notheguyouthink 9y ago> It's surprising how big programs are. Very basic android apps can weigh in at 30-60mb, and I've noticed cordova apps are particularly bad for that. Imagine needing to pull that much data every time you visited a new site. Bit of a straw man Imo. WASM is specifically designed with page load in mind. It's why the garbage collector specification is so important, as languages with GCs want to use WASM but they don't want to ship their own for fear of slowing down page speeds. > We're already seeing this weird situation where websites that are perfectly usable in urban areas become impossible to use in the mountains. Urban telcom networks can be upgraded to make a 60mb runtime feel reasonable, but a lot of rural networks don't even work for todays sites. I agree completely, though for this I blame the companies/devs targeting a specific audience more than anything. Ie, I don't think it's the fault of "the modern web" or what languages/etc we use today for slower page speeds. For the same reason I don't blame languages we have today for desktop applications that aren't as "fast" as they could be. We have more RAM than we did 20 years ago, and conversely programs use more available RAM. The program might be doing a "better" job (hard to measure, but I imagine UX is the main concern), or it might be doing a worse worse job.. but at the end of the day, developers took the opportunity to use languages/frameworks that used more RAM, for one reason or another. So, just like the RAM, higher internet speeds and faster browsers have led to developers using more bandwidth than ever before. We use just as much as we can get away with, and always will. Sure, WASM may change our idea of what is acceptable, but I don't think it will by too much. We're impatient beings, we want the damn page to load fast as hell. How willing do you think the ~2B Facebook users are to wait 30s while it downloads hundreds of MiB of some FB WASM app? I think people would flip out. As an aside, what I think will be really interesting, will be compiling normal non-web apps WASM, as a deployment target for systems. Hypothetically, it could be the new "native" and vastly easier to deploy to for all OSs. Not intended to run on web, but still WASM. Talk about cool, Imo
- codingmyway 9y agoThat dream is one that many have tried to achieve but it's what I call the software paradox: any system or framework that is capable of doing everything is so complex to learn and configure that it's nearly always easier to build something bespoke from scratch
- oblio 9y agoI don't think that the complexity is unbounded. The Java standard libraries and the .NET BCL are really big, true, but you don't need to use all of them to use them. They're quite neatly segmented. The fact that we have both libraries is due to reasons mostly outside of software development and computer science concerns (licensing, politics, etc.). I don't see why for any non-vertical domain, in theory, we couldn't manage the complexity of having just one huge standard library available to Java, C#, Python, Ruby, etc. Verticals are another story, that's where things get scary. But I wouldn't put medical imaging libraries in the standard libraries, anyway :)
- ryanbrunner 9y ago> I don't see why for any non-vertical domain, in theory, we couldn't manage the complexity of having just one huge standard library available to Java, C#, Python, Ruby, etc. I think you can look to pre-existing multi-language ecosystems like the JVM, .NET, etc. that show that this isn't always the greatest idea. Languages have different idioms and ways of approaching problems, and using a standard library geared towards a stateful, OOP language is going to feel out of place and awkward in a functional language (and vice versa).
- coldtea 9y agoWe could have gone with a better JS replacement adopted by all players -- with ints, typing (or gradual typing), more optimisable, better memory management options (e.g. buffers, "value objects", etc)... With the current speed of replacement of evergreen browsers it would take 2-3 years and we could start using it (some immediately if they only targeted specific newer browser versions e.g. for their enterprise apps). Instead we got exactly what you describe + piling on stuff on top of JS.
- ryanbrunner 9y agoAnd we'd still be stuck with a "one-size-fits-all" mentality for the browser. The desktop and server environments have amply demonstrated that different languages have different strengths, and it's a good thing in my mind that we can have solutions tailored for different sorts of problems and applications.
- coldtea 9y ago>The desktop and server environments have amply demonstrated that different languages have different strengths I believe that the main thing demonstrated in practice is that everybody [1] just likes one or another Algol derived language, from a small set of languages with superficial differences between them. Java, C#, Golang and their dynamic cousins, Python, Ruby, Javascript which have suddenly all adopted a longing for static types (Typescript and flow, Python type annotations, etc) and for async execution (asyncio, channels in Golang, async/await in C#, etc), and all piling functional features. It's like they are converging. Sure, they still have semantic and syntactic differences, but in the end, not that important in the grand scheme of things. I think that not catering to any superficial preference of all programmers can eliminate endless bikeshedding and be hugely beneficial -- it worked wonders for JS both in terms of industry involvement (excellent JITs and tooling from 4 huge vendors), and in terms of traction/community/libs. What's sad is not that we don't have 20+ languages for the web, but that the one we have was a quick kludge for a totally different use, and not that great for what it's now used. [1] the casual expression meaning "most people", not the universal quantifier meaning "all with absolute no exceptions".
- ryanbrunner 9y agoThe thing is, at the end of the day, the language used to develop the site should be completely irrelevant for the user. You're not using Java or .NET to run your site, you're running WebAssembly. The tools used to generate that should be as irrelevant as whether someone used Gimp or Photoshop to create the images on the site that you're using. Bloat is always a concern, but I don't see how WebAssembly materially changes things - as it stands right now, you're downloading the "runtime" for virtually every site you use in the form of a javascript bundle packaging up every library used to make a site function.
- oblio 9y agoI think it will be much worse. Want to bet that there will be checklists and sales pitches on development tools websites where the likes of Microsoft, Oracle, Borland (Embarcadero?) will sell developers the possibility to build apps for the web using their runtimes, which will be 100% forklifted to the Web? As-in, share-nothing, just their existing libraries cross compiled to WebAssembly. And we will have to use those apps because we will need them for specific purposes (the typical example is enterprise apps, but also government sites, educational sites, etc.)
- ryanbrunner 9y agoI'm sure that there's going to be inefficient, bloated libraries out there. That's really no different than the Javascript world today. But as time goes on, I believe the more efficient libraries, frameworks and tools will win out. No one uses jQuery UI or Sproutcore these days. The same will be true of any bloated monstrosity that is compiled to WebAssembly.
- shakna 9y ago> But as time goes on, I believe the more efficient libraries, frameworks and tools will win out. The average webpage today weighs in at 2.5mb. I don't think that demonstrates an efficiency win over time.
- 9y ago
- kronos29296 9y agoRight now we have a dozen languages that transpile to JS. What WASM proposes is that we replace that with WASM. Then we will have several dozen languages with JS in first place that have critical bits compiled to WASM. We still have frameworks and other fragmentation but It promises performance. What you say may happen but what the primary purpose of WASM is to replace JS as the target of compilation as it is now. They want a more robust and lower level language which can give higher performance as the base kinda like LLVM except for browsers. So languages like Typescript, Dart, Elm don't have to transpile to JS but to WASM which is less work and more performance.
- rf15 9y agoI don't think it is that easy. These languages rely a lot on the underlying Javascript features and how they work, like objects, strings, etc. - browsers had a long time to optimise JS interpretation on the level beyond primitive values: OO-features in general, reusing classes/objects efficiently, good string concatenation/handling, things like that. And suddenly, Typescript et al should take care of those features as well? Sounds like an explosion of low-level feature requirements if you cut out the JS middleman.
- sbarre 9y agoWhat if you just add a generalized JS-to-WASM step then? That way all languages that currently transpile to JS could use that same final step.
- rf15 9y agoyou could do something like V8 in wasm, sure, but.....think about this for a bit: in chrome, you already have V8 as a native implementation, without the overhead of wasm -> cpu instructions. nothing would be gained. You would need to do memory/etc. management on a level that is either more in line and more optimizable with your language design, or just stick to things as they are.
- Matthias247 9y agoCompiling JS to WASM has the same problems as just compiling JS to normal assembly ahead of time: It's just too dynamic. The thing which you can compile ahead of time is an interpreter, which then checks during runtime what the actual types are and what needs to be done. You can run such an interpreter in WASM, but that will be a lot slower than what the current JS engines are able to do with Just In Time compilation. I don't know whether it's possible to implement a JIT compiler in WASM (and thereby dynamically output and execute WASM), but running a JIT-in-WASM on top of a native-JIT (the JS engine) sounds not really desirable.
- carmate383 9y agoThis is like saying "I don't like running multiple native programs on my computing device because the machine instructions were compiled by different programming languages".
- TomMarius 9y agoWhat he's saying is he doesn't want to download JVM each time he opens a page, and would rather have all pages use the JVM he already has. What you said has nothing to do with the original comment.
- carmate383 9y ago"I don't want to load machine instructions for libboost every time I run a native C++ application".
- Volt 9y ago"I don't want to download libboost and load its machine instructions every time I run a native C++ application".
- wruza 9y agoI'm not sure, but don't browsers already cache link-rels from html? What's the difference in jvm.asm vs. framework.js cached downloads?
- TomMarius 9y agoNone, but nowadays, people don't use CDNs, but a huge bundle they made themselves.
- k__ 9y agoThe question is, how much of the pros that took people to do JavaScript/browser front-ends are available for WASM apps? X-to-JavaScript compilers were available for decades now, still most write their stuff in JavaScript. What WASM will change, I think, is that libraries or applications, that were native before, now get ported to the browser. So JS devs will do what they always did, maybe a bit more every year. And people who didn't write browser apps, will more and more move to do their thing with WASM. Also, look into enterprises, it will take them an eternity to get new WASM-enabled browsers to their users and even then I could imagine their admins to disable it.
- dspillett 9y ago> X-to-JavaScript compilers were available for decades now, still most write their stuff in JavaScript. A lot of that is friction and fear of pigeon holing, that using something that transpiles to JS will limit project/career options later more so than plain JS will. I don't see that as a big issue as long as you keep an eye on developments elsewhere, at least it is no bigger issue than using a particular framework for your application. Then again I've out of date in this area (I keep an eye on developments and played with some of them, but have used-in-anger very little newer than jQuery), having specialised somewhat data-side when I'm not working on legacy projects, so I could be wrong there. > What WASM will change I think the key difference between JS transpilers and using WASM is that the latter promises significant performance improvements for some work where the former is more syntactic sugar for the developers (improving their performance rather than the application's, or perhaps even sometimes at the cost of a little app performance due to the extra abstraction). I see WASM finding a very useful niche in libraries for number-crunching, AI, and other compute intensive tasks, while the majority of any project's code outside that (where there is no practical performance gain to be had) remains JS.
- bigato 9y ago> Also, look into enterprises, it will take them an eternity to get new WASM-enabled browsers to their users and even then I could imagine their admins to disable it. I work at a 100k+ employees enterprise in the financial sector and our official, sanctioned browser version is about to be one that has wasm enabled by default. The fact that old versions make systems vulnerable to attacks have been changing this enterprise culture of rarely updating software.
- rf15 9y agoCan we all solemnly swear that we will never port the JRE to webassembly? Please? I mean, it's ridiculous to have Java Assembly -> WebAssembly -> CPU Assembly. Actually.... this is missing some more abstraction layers, like a precompiler or two - let's have Tomcat and Groovy or something on WebAssembly :D !
- kodablah 9y agoNo [0], and no in the other direction [1] (disclaimer, I'm the author of the latter) 0 - https://github.com/konsoletyper/teavm https://github.com/konsoletyper/teavm 1 - https://github.com/cretz/asmble https://github.com/cretz/asmble
- rf15 9y agoI know. It just has so much potential to create awful endless abstraction stacks.
- Matthias247 9y agoI guess it's already too late. Last week there was this here: https://news.ycombinator.com/item?id=14587296 https://news.ycombinator.com/item?id=14587296 http://leaningtech.com/cheerpj/ http://leaningtech.com/cheerpj/ As far as I understand it currently uses JS as a target, but might switch to WASM soon. But don't worry about the abstraction layers, we might even have some more :-) E.g. some kind of intermediate language between WASM and CPU assembly (like LLVM IR). Or the CPU µops which are even below the real assembly. Or Java maven plugins like annotation processors, which transform some Java code into others. Or even on top of that some interface definition languages, which are transformed into Java through code generators.
- vorg 9y ago> let's have Tomcat and Groovy or something on WebAssembly :D ! Not sure if Apache Groovy is a good example of software that might benefit from a WebAssembly target. Somebody already tried creating an edition that compiles to Javascript, but I guess it doesn't get used much because its Wikipedia page is being considered for deletion on the grounds it's "Not a notable software library". [1] [1] https://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Grooscript https://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletio...
- tom_mellior 9y ago> many re-implementations of things in various incompatible/slightly incompatible languages This is why WebAssembly's lack of a garbage collector (which could be optional) strikes me as strange. What we'll get is every web page including code implementing an informally specified, bug-ridden, slow GC instead of using the excellent ones already present in browsers. I hope this will be fixed. I understand that not every programmer and not every language wants to pay GC costs, but there are ways around that. (Even without GC, the same applies to languages that explicitly manage memory for "speed". Their implementations will also have to work hard to provide "fast" allocators on top of the primitives provided.)
- YCode 9y agoI thought it might be on the compiling platform to provide GC if it wants to. As you said some devs/apps are better off without GC, but also I imagine competition would more or less ensure the most performant or overall effective platforms would end up being the de facto standards. And some platforms (e.g. React, Vue, etc.) may find one GC tends to work better than another for them or want to implement their own. I'm not sure if WASM can host libraries on CDNs, but if so once a user has that stuff cached from one site or another bloat wont really be a problem either.
- tom_mellior 9y ago> I thought it might be on the compiling platform to provide GC if it wants to. Yes, the compiling platform can use WebAssembly's memory primitives to implement its own GC. But (besides the wasted work of implementing it) this is unlikely to be as efficient as a native, tuned GC on the target platform.
- Ajedi32 9y agoGC support [is coming][1]. Just because they didn't include it with the initial Minimum Viable Product release, doesn't mean it won't ever be available. [1]: https://github.com/WebAssembly/design/issues/1079 https://github.com/WebAssembly/design/issues/1079
- 9y ago
- tannhaeuser 9y agoI think you're missing the more imminent concern: that entire vendored browser runtimes are shipped as wasm packages, taking away ad blockers, hyperlinking, translating, accessibilty ...
- lmm 9y agoSurely the best hope for interop is something like WebAssembly - right now if I'm using two compile-to-JS languages it's pretty unlikely they'll be compatible, whereas with WebAssembly there will at least be a common notion of e.g. what an integer is. Hopefully that can translate into a common ABI. > From a certain point of view diversity is good, on the other hand there's so much fragmentation. One of the dreams when computers appeared was that programmers will build libraries that everyone will use and people would just build on top of these libraries, reaching ever higher. And main reason this hasn't happened is the lack of a good common ABI/runtime. Libraries do get reused cross-language on the JVM or CLR, but only within that platform; outside it only the lowest-common-denominator C ABI exists which means interoperation between high-level languages is basically impossible. Moving everything onto the web is a chance to make that possible.
- entelechy 9y agoThe current reality is worse: ClojureScript, Elm, Elixir CoffeScript, Babel and Emscripten all compile to Javascript and ship their own Runtime. Given the complexity of Javascript it is not a good fit as a compilation target.