News for hackers. Stuff that matters.
Re:Missing the Point of WebAssembly by neilalexander on Tuesday January 09, 2024 @02:26PM (#38930675)
It is strange to me to see so much talk about all of the places WebAssembly could live, like IoT devices and edge lambdas and cross-architecture binaries, places that don't really need these problems to be solved, and yet so little talk about whether or not it can finally unshackle the web from the mess that is JavaScript. As I understand it, it's not even really possible today to make WebAssembly do anything meaningful in the browser without trampolining back out to JavaScript anyway, which seems like a remarkable missed opportunity.
Re:Missing the Point of WebAssembly by aseipp on Tuesday January 09, 2024 @03:59PM (#38932025)
> As I understand it, it's not even really possible today to make WebAssembly do anything meaningful in the browser without trampolining back out to JavaScript anyway, which seems like a remarkable missed opportunity.

It was always the goal for WebAssembly code living in the browser to have some form of object model/DOM integration, and interaction with JavaScript objects. What form it would take exactly wasn't clear. But that was never a goal for the original 1.0 specification (MVP), and not even in spec for the current 2.0 draft -- which mostly add a bunch more useful instructions and features, but nothing earth shattering.

The reality is that whatever solution gets accepted has to be supported and continue working for what is effectively ~infinite time, in multiple major browser engines. For custom runtimes it's sort of "whatever", but webpages can live forever so it's taking a lot of time to get right. But there was clearly a lot of value to be had without that, hence 1.0 was the "MVP."

Re:Missing the Point of WebAssembly by CharlesW on Tuesday January 09, 2024 @02:56PM (#38931126)
Wasm isn't a replacement for JavaScript. I think it's clever to leverage JavaScript as an interface to an ever-changing and extremely broad suite of native browser APIs, and keep Wasm small, fast, and secure.
Re:Missing the Point of WebAssembly by josephg on Tuesday January 09, 2024 @03:19PM (#38931516)
> Wasm isn't a replacement for JavaScript

I think a lot of people want it to be a replacement for JavaScript. And I think that makes sense, if for no other reason than learning JavaScript is a hassle. Lots of folks think of themselves as a C# developer, or a Python developer or whatever. A lot of developers would rather make websites in their language of choice than learn JavaScript. (And who can blame them?). Webassembly (with GC bindings) should be able to make that possible.

Re:Missing the Point of WebAssembly by bmoxb on Tuesday January 09, 2024 @03:45PM (#38931853)
Learning new languages may be component of it, but I think more generally, different languages are suitable for different problems and different developers. Being free to use the most suitable or preferred tool for a task is undoubtedly desirable, rather than having JavaScript as the only option.

And, while more of a personal opinion, JavaScript is not a well designed language - permanently shackling the web to it prevents progress forward.

Re:Missing the Point of WebAssembly by JoshTriplett on Tuesday January 09, 2024 @03:34PM (#38931713)
Indeed. node.js was popular in part because you can use the same language on the client and the server. All-WebAssembly no-JavaScript sites would allow the same thing with other languages.
Re:Missing the Point of WebAssembly by ern on Tuesday January 09, 2024 @05:20PM (#38933079)
As much as many people want alternatives to JavaScript, there are also people who consider themselves JavaScript experts (or the various related languages like TypeScript). They’ve invested a ton of time and effort into getting to where they are.

There’s a balance between disruptive change and keeping these folks on board. Get it wrong and you’ll end up with it strangled in its cradle.

My own take is that low-code platforms will continue aggressively moving into this space, especially in the enterprise space. They come with their own problems and are often aggressively overhyped, but they will put pressure on “traditional” developers to move faster and look for better solutions.

Re:Missing the Point of WebAssembly by hutzlibu on Tuesday January 09, 2024 @07:08PM (#38934254)
"As much as many people want alternatives to JavaScript, there are also people who consider themselves JavaScript experts (or the various related languages like TypeScript). They’ve invested a ton of time and effort into getting to where they are."

I do not see a problem here. The idea is not to replace js (not realistic anyway), but to have a full working alternative to not have to use js anymore, so in the end you can really choose how to build for the web.

I also invested heavily into js ... but I am really looking forward to the day, I can use something sane again.

Re:Missing the Point of WebAssembly by mr_toad on Tuesday January 09, 2024 @09:59PM (#38935604)
> A lot of developers would rather make websites in their language of choice than learn JavaScript. (And who can blame them?).

Personally I’m quite happy to blame them. If I want to do ML I use Python, if I do statistics I use R, for messing with Windows I use C#, for using databases I use SQL and for the web I use JavaScript. I think that refusing to learn other languages is a foolish consistency.

Re:Missing the Point of WebAssembly by satvikpendem on Wednesday January 10, 2024 @12:58AM (#38936744)
If those all compiled to WASM, then you can mix and match freely.
Re:Missing the Point of WebAssembly by pjmlp on Wednesday January 10, 2024 @01:33AM (#38936965)
Already possible in .NET for years, it is called Common Language Runtime for a reason.

Also TIMI on IBM i, language environments on z/OS, among other examples.

Re:Missing the Point of WebAssembly by satvikpendem on Wednesday January 10, 2024 @01:44AM (#38937040)
True, but imagine being able to interop with all the languages ;)
Re:Missing the Point of WebAssembly by pjmlp on Wednesday January 10, 2024 @01:56AM (#38937081)
I don't need to imagine,

> More than 20 programming tools vendors offer some 26 programming languages — including C++, Perl, Python, Java, COBOL, RPG and Haskell — on .NET.

Taken from https://news.microsoft.com/2001/10/22/massive-industry-and-d...

In 2001.

Re:Missing the Point of WebAssembly by tredre3 on Wednesday January 10, 2024 @03:13AM (#38937580)
https://en.wikipedia.org/wiki/List_of_CLI_languages

At first it seems like an impressive list of languages! But upon closer inspection, over half of them are either abandoned or are commercial products that have been coasting mostly unmaintained for a decade... By now even the JVM ecosystem is a lot healthier.

With WebAssembly, all languages[1] supported by LLVM can be compiled with no custom compiler nonsense. AND we get all the languages[2] that depend on those languages for free as well! The entire burden is on LLVM (and soon GCC) with everything benefiting downstream, surely you can see how it's different from CLI/JVM?

This time the compile-once-run-everywhere promise might actually be true.

1. C, C++, Zig, Rust, etc 2. Python, Perl, PHP, Lua, we can even do some inception with webassembly runtimes.

Re:Missing the Point of WebAssembly by pjmlp on Wednesday January 10, 2024 @03:32AM (#38937729)
Just like it happened during the last 25 years, the amount of languages where people will be willing to keep the effort, daily, will fade way.

Or the money from all those VC firms betting the farm on Webassembly startups will dry out.

Until someone comes up with yet another bytecode format, claiming yet again to be UNCOL from 1958.

https://en.wikipedia.org/wiki/UNCOL

Re:Missing the Point of WebAssembly by satvikpendem on Wednesday January 10, 2024 @05:05PM (#38943977)
LLVM is now the modern version of UNCOL, it seems.
Re:Missing the Point of WebAssembly by mr_toad on Wednesday January 10, 2024 @06:28PM (#38945095)
> With WebAssembly, all languages[1] supported by LLVM can be compiled with no custom compiler nonsense.

You can do that without WASM. This really reinforces the authors point.

Re:Missing the Point of WebAssembly by dmazzoni on Tuesday January 09, 2024 @11:48PM (#38936308)
What you're describing already exists today, that's exactly what Blazor is:

https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blaz...

Blazor lets you build web apps using C#. It achieves that by running C# inside WebAssembly.

Re:Missing the Point of WebAssembly by josephg on Wednesday January 10, 2024 @12:45AM (#38936666)
Yeah I know; but blazor is huge because it needs to ship its own garbage collector and object runtime. Google says 1.3mb for a hello world blazor app.

With wasm-GC, blazor should get way faster and smaller. And the blazor-(JS & DOM) bridge can be massively simplified too. I don't see any good reason for blazor apps to be any larger than the equivalent react app. And that will make it a much more viable platform.

Re:Missing the Point of WebAssembly by DonHopkins on Wednesday January 10, 2024 @12:54AM (#38936713)
There's also something that you might have actually already heard of called Unity3D. And it's actually widely used and supported and taught by more than a few people and companies and educational institutions.
Re:Missing the Point of WebAssembly by devjab on Wednesday January 10, 2024 @08:11AM (#38939074)
Blazor is silly. It’s more complicated to use than simply using React/Angular/Whatever you want and it’s less efficient, take up huge amounts of space and is much harder to debug. Coupled with how hard it is to actually build reusable components in any sane way…

It may get there eventually, but as with most C# things these days, it’s mostly meant to sell other Microsoft products to the horde of developers who view themselves as single language developers. The real risk isn’t so much in the technology, however, it’s in whether or not Microsoft abandons it before it’s good like they have with their previous GUI frameworks going all the way back to ASP classic. I know that angular made a big leap from JS to TS, but aside from that, your major JS frameworks have been fairly stable in the same time frame that Microsoft has gone through web forms, mvc, razor, whatever the hell the web-api bundled with X period was and now Blazor, and what is the most telling of all is how virtually every Microsoft Office365 product is written in JS. Would you really bet on a semi-shitty technology that doesn’t even see adoption within the company that makes it? Well, I guess you do considering you’re using C#.

Re:Missing the Point of WebAssembly by DonHopkins on Wednesday January 10, 2024 @12:38AM (#38936625)
> learning JavaScript is a hassle

People who think learning JavaScript is a hassle aren't serious programmers, because what they've actually decided is that learning is a hassle, which is a terrible dead-end anti-intellectual attitude, and they've just decided to blame their learning disability on JavaScript. Real programmers learn new things throughout their entire careers.

Yes JavaScript has flaws. But learnability isn't one of them. And WebAssembly certainly isn't any easier to learn or program in than JavaScript. The problem isn't JavaScript, it's uneducable conservative luddites who refuse to learn anything new (or even as old as JavaScript), who think they know it all already and nothing's ever going to change.

So-called programmers who think they never need to learn any other languages or anything new have much worse flaws than the languages and tools they refuse to learn.

Re:Missing the Point of WebAssembly by josephg on Wednesday January 10, 2024 @12:56AM (#38936727)
Personally I agree with you. I've touched code in about 5 different languages in the last month alone. But the majority of programmers out there aren't like you and I. Most programmers see themselves as a "java developer", or a "python developer" or an "android developer". They aren't full terrain engineers who go wherever the song takes us. Lots of programmers want to write code in their preferred language, close tickets, get paid and go home at the end of the day happy. It will always be an uphill battle to convince a lot of these people to spend their weekend learning javascript.

Its much easier to make wasm good. Let Go programmers use go to make websites. Why not? If its any consolation, they'll still need to learn HTML and CSS in the process. Javascript isn't going anywhere if they want to make the switch later.

Re:Missing the Point of WebAssembly by DonHopkins on Wednesday January 10, 2024 @01:08AM (#38936800)
You're right. I don't consider those people serious programmers, just uneducable monolinguistic coders, who are going to find their dead-end jobs easily replaced by AI.

ChatGPT is not just useful for banging out boilerplate code, it's much more useful for teaching programmers who are willing to learn new apis and how to code in new languages and better in the languages they already know.

And that opportunity is missed on monolinguistic coders who refuse to learn or even read the fucking manual, and just see AI as a replacement for posting "just give me the codes" and copying and pasting from Stack Overflow.

Real programmers aren't going to be replaced by AI. Programmers who refuse to use AI and refuse to learn are going to be replaced by AI and programmers who are capable and enthusiastic about learning.

Re:Missing the Point of WebAssembly by satvikpendem on Wednesday January 10, 2024 @12:59AM (#38936758)
Just use Flutter, that's what they're already doing, similar to Blazor. In fact, Chrome shipped WASM-GC and Flutter has an experimental build that uses it.
Re:Missing the Point of WebAssembly by konsoletyper on Wednesday January 10, 2024 @04:22AM (#38938106)
Looks like most people have misunderstanding: they think that WebAssembly is the only way to run their favourite language in the browser. However, there's another way that exists for decades: simply use compiler of their favourite language that produces JavaScript! As for Java, GWT exists almost 20 years. Another example I know of is Brython which runs Python on top of JavaScript. However, looks like Java developers don't like to write websites, even while GWT is there.

And according to my experience, WebAssembly is not a game changer: it does not provide extra performance here, neither does it allow to get smaller binaries. I'm a developer of another Java-to-JavaScript compiler, TeaVM. I recently compared performance of JavaScript and WebAssembly targets, and in one particular case WebAssembly is slower: https://teavm.hashnode.dev/comparing-teavm-with-kotlinjs-pef.... There's another example where WebAssembly is only slighly better: https://teavm.org/gallery/jbox2d/index.html. In both cases WebAssembly binary is huge compared to JavaScript. On one hand this can be because of I don't target Wasm GC, so binaries get bloated because of need to maintain shadow stack. On another hand, there's Google Closure Compiler, which produces Wasm GC binaries, and from what I heard of it, WebAssembly binaries still don't win in their size.

Re:Missing the Point of WebAssembly by rdtsc on Tuesday January 09, 2024 @03:34PM (#38931714)
> As I understand it, it's not even really possible today to make WebAssembly do anything meaningful in the browser without trampolining back out to JavaScript anyway, which seems like a remarkable missed opportunity.

That's the underlying messy API it's built on. There are specs to make the API more standardized like https://github.com/WebAssembly/WASI

But overall, yeah, it feels like a shiny new toy everyone is excited about and wants to use. Some toys can be fun to play with, but it doesn't mean we have to rewrite production systems in it. Sometimes, or most of the time, toys don't become useful tools.

Re:Missing the Point of WebAssembly by dylan604 on Tuesday January 09, 2024 @03:51PM (#38931927)
Isn't that specifically why they are called toys and not tools?
Re:Missing the Point of WebAssembly by rdtsc on Tuesday January 09, 2024 @03:57PM (#38931999)
That's the idea! If we can just convince people who make product and technology decisions to see that and not push the next shiny toy as the new tool or library everyone has to use, we'd all be in good shape :-)
Re:Missing the Point of WebAssembly by DonHopkins on Wednesday January 10, 2024 @01:00AM (#38936761)
Because you think Unity3D should have stuck with its tried and true Flash back-end instead of moving on to shiny toy WebAssembly?

https://forum.unity.com/threads/return-flash-deployment-back...

>Flash was not discontinued "because it couldn't provide good graphics". It was discontinued, because we no longer believe that Flash as a platform has any future. That has not changed.

Re:Missing the Point of WebAssembly by dmazzoni on Tuesday January 09, 2024 @11:57PM (#38936384)
You seem to think WebAssembly is a "toy" and nobody's really found a good use for it, but actually it's being used in some really successful and high-profile web apps, but it's so seamless that you probably don't even realize it.

Here are some of my favorite examples:

Figma

Google Earth

Photoshop Web

Any Unity games you've played on the web: WebAssembly.

Everything built using the Blazor framework in C#: runs on WebAssembly on the web.

I really don't think all of those sites are using WebAssembly because it's a cool new toy. They're using it because it's actually pretty useful technology that enables you to build really powerful software that runs on the web browser without being limited to JavaScript.

Re:Missing the Point of WebAssembly by evrimoztamur on Tuesday January 09, 2024 @02:53PM (#38931082)
Yep, we are still generating bindings, but I don’t think that’s going to change anytime soon. WebAssembly to JavaScript is what the C ABI is to Python, with an additional bounce back to JavaScript land.
Re:Missing the Point of WebAssembly by danielvaughn on Tuesday January 09, 2024 @02:32PM (#38930761)
It can perform a lot of computational work, but yeah it can't yet interface directly with the DOM. I'm not sure about whether it can access the network or other things, but I don't believe that it can.
Re:Missing the Point of WebAssembly by ryukafalz on Tuesday January 09, 2024 @04:15PM (#38932198)
> but yeah it can't yet interface directly with the DOM

The Spritely folks are doing DOM manipulation from Scheme in Wasm, is there something beyond this that you're referring to? https://spritely.institute/news/building-interactive-web-pag...

Re:Missing the Point of WebAssembly by steveklabnik on Tuesday January 09, 2024 @04:52PM (#38932665)
When people say "can't yet interface directly with the DOM," the "directly" is the key bit. Projects in webassembly have been able to interact with the DOM forever, but they need to do it via JavaScript shims. I am not intimately familiar with Spritely, but from reading the post briefly, it appears this is exactly what they're doing:

  Scheme.load_main("hello.wasm", {}, {
    document: {
      body() { return document.body; },
      createTextNode: Document.prototype.createTextNode.bind(document)
This requires boilerplate and adds overhead that would not exist if it were able to be done "directly."
Re:Missing the Point of WebAssembly by davexunit on Tuesday January 09, 2024 @05:10PM (#38932941)
I suspect as time goes on we'll see more and more of this become direct through optimization. My understanding is that this already happens for certain well-known methods, like if you import Math.sin or something V8 is going to optimize it to a direct call when it compiles the Wasm module that imports it. And maybe a non-JS interface will emerge, but there needs to be some kind of layer that preserves capability security. You wouldn't want any and every Wasm module to have access to the entire browser API. You will still want the ability to omit capabilities, attenuate them, etc. and for that a full programming language seems necessary and well... JS is already there.
Re:Missing the Point of WebAssembly by edgyquant on Tuesday January 09, 2024 @03:35PM (#38931721)
Are there plans to add DOM support? That seems pretty critical for what I had thought wasm was supposed to be myself.
Re:Missing the Point of WebAssembly by davexunit on Tuesday January 09, 2024 @04:36PM (#38932449)
Wasm allows for importing host functions. Those host functions could provide DOM access. With Wasm GC it is possible to pass external references (DOM nodes, promises, etc.) to and from Wasm. What this looks like in practice is that a thin JS bootstrap script instantiates the Wasm module, passing along a set of JS functions that map to the declared Wasm imports and then the program is effectively driven from Wasm at that point.
Re:Missing the Point of WebAssembly by danielvaughn on Tuesday January 09, 2024 @03:50PM (#38931915)
I'm not sure. All I know is that there are some hurdles to get past. One of them is that several DOM APIs were created specifically for JavaScript, which is...really disheartening.
Re:Missing the Point of WebAssembly by 0x457 on Tuesday January 09, 2024 @09:11PM (#38935279)
WASM in the browser can do exactly one thing aside from what is in WASM spec - interface with JavaScript.

It's not even that slow to interface with JS from WASM if you do it right (i.e. you aren't passing strings back and forth).

Re:Missing the Point of WebAssembly by holoduke on Tuesday January 09, 2024 @03:01PM (#38931210)
How can a language be a mess? I hear lots of personal frustrations. But saying a language is a mess is too short sighted I believe.
Re:Missing the Point of WebAssembly by solardev on Tuesday January 09, 2024 @03:28PM (#38931657)
Correct me if I'm wrong, but aren't most languages designed and controlled by some relatively centralized organization, whether a company or a nonprofit?

Javascript, on the other hand, is a loose standard that different companies kinda sorta adhere to. It was a rushed one man project put out to compete with Java back in the 90s, then every browser tried to do their own somewhat compatible implementation. Javascript became the lowest common denominator, winning out not because it was better than say Java or ActiveX or Flash or whatever. It was just commonly available.

Fast forward a couple decades, the situation is both better and worse. We at least have ECMAScript now, and the core language has certainly gotten better and more dev-friendly.

Unfortunately, what ECMAScript covers is so limited and the standard lib is still so poor that lodash and similar are common just for basic data manipulation, not to mention the hundred DOM abstractions like React or Vue or Svelte, and occasionally Angular. And client-side state is its own nightmare, and then persisting things into cookies/localstorage/indexedDB is a whole other can of worms, along with different ways to do pub sub. Being tethered to file-based HTTP and HTML means that even basic routing is a hack on top of a hack.

There is no standard package manager, and npm is a third party project, which can't agree on which module format to use. Libs from like 2 or 3 years ago will often be incompatible with new code.

And that's just assuming you're using a browser. Outside of that there's not even a standard runtime, between Node, Deno, Bun, etc.

Typescript is yet another third party add on, not something baked into the language.

Eslint, prettier, etc. are all third party things.

In the old days a lot of this used to just be baked into the language itself, or at least an official IDE . If you ever had a chance to use Visual Studio (Not VSCode) in the old days, everything was so well designed and integrated, from code organization to the standard libs to the UI editor.

Nowadays there's 300 ways from 200 companies to do anything in Javascript, none of it particularly good or secure or performant or easy to read.

In a way it's natural selection, I guess, with different implementations all competing for supremacy, but it definitely is messy. Every time I use JS (which is every workday) I can't help but wish some other, more coherent, language won out.

Re:Missing the Point of WebAssembly by stevage on Tuesday January 09, 2024 @04:40PM (#38932523)
These are...weird criticisms. You basically seem to wish you were coding within a monopoly, for a single platform controlled by a single corporation. Perhaps Swift is where you would like to be?

JavaScript does incredibly well for the constraints it operates within. The fact that Node and Deno etc even exist is pretty remarkable given the primary purpose of JS.

The fact we even have ES modules is in large part because the third party NPM worked so well. Things start out messy then they gain traction and get standardised. JS isn't a loose standard at all, it's incredibly well defined, and few of its original Netscape origins really remain.

You have a bit of a point about TypeScript. It'd definitely be nicer if this was part of the language and didn't require so much third party tooling. It seems plausible that this too might happen in a few years. Perhaps browsers will gain first class support for it.

Re:Missing the Point of WebAssembly by eitland on Tuesday January 09, 2024 @07:56PM (#38934712)
Take it from someone who has made meaningful code in JS since 2005:

- JS as a three week project is amazing

- JS as a lingua franca for web is a disaster in the same league as null pointers. It is like if backend had decided to standardize on PHP early on (if you disagree, try to mention one thing except syntax that isn't as bad in JS as in PHP, and the syntax is actually a blessing in disguise, if JS had looked like PHP it wouldn't had become a standard)

- The fact that people has made a very productive ecosystem on top of the collection of footguns that is Javascript is of course equally impressive if not more

Please note that this post praises both the inventor of JS as well as the JS ecosystem.

But that does not mean that Javascript is a good language.

Re:Missing the Point of WebAssembly by wvenable on Tuesday January 09, 2024 @07:20PM (#38934363)
> You basically seem to wish you were coding within a monopoly, for a single platform controlled by a single corporation.

Benevolent dictatorship has it's advantages. The JavaScript ecosystem is messy -- exactly why is up for debate and whether that's good, bad, or unimportant is also up for debate.

Re:Missing the Point of WebAssembly by solardev on Wednesday January 10, 2024 @12:23PM (#38940880)
> These are...weird criticisms. You basically seem to wish you were coding within a monopoly, for a single platform controlled by a single corporation.

You know, I never really thought about it that way, but I think you're right!

<lazy dev hat>That WOULD be nice! A standard way to do anything, no need for unnecessary reinventions of the wheel... progress would slow down a bit, sure, but that's OK, nobody can keep peace with this lightning-fast explosion anyway, and slow and steady is more sustainable than volatile bubbles everywhere anyway. I think I would enjoy working in such a system...</lazy hat off>

<open source hat on>Unfortunately, that'd also mean a closed ecosystem and we probably wouldn't have had the amateur dev boom that HTML/JS/CSS and its visible source gave us. I hate the messiness of that ecosystem, but I can't deny that the openness gave a boatload more people opportunities than the closed platforms. Maybe that's just the price we have to pay =/ </hats away>

> Perhaps Swift is where you would like to be?

I never tried. Is it nice? As a user I find iOS quite obnoxious, but maybe developing for it is different...?

Re:Missing the Point of WebAssembly by jampekka on Tuesday January 09, 2024 @04:41PM (#38932528)
ECMA standardized ECMAScript in 1997, only two years after Netscape Navigator first shipped Javascript. ECMAScript and Javascript are the same thing. I've never encountered a language level incompability in the different ECMAScript implementations. The same can't be said e.g. about the extremely commitee driven C++.

The browser APIs are specced by W3C and WHATWG. For newer APIs there are usually differences in browser implementations, but these tend to get ironed out quite fast.

Re:Missing the Point of WebAssembly by solardev on Wednesday January 10, 2024 @12:40PM (#38941042)
While this might be technically true, my own (anecdotal) experience has been quite different.

I've been writing JS since its invention, initially just using it (as a kid) for silly Geocities gimmicks and infinite window.alert() loops. I still remember how back in the day no two browsers had a totally compatible JS implementation (especially when Microsoft was busy trying to embrace-extend-extinguish), some things would be subtly different (like datetime handling, or window vs document, whatever)... it wasn't just me either, there used to be a lot of articles that discussed things like that. Here's one: https://burningbird.net/netscape-navigators-javascript-1-1-v...

In my memory, nobody really discussed ECMAscript back in those days. It was more about Netscape/Mozilla vs IE vs Phoenix's JS engines (can't remember if Phoenix used the same JS engine as Netscape), and then different versions of jQuery or early Angular, browser prefixes, early polyfills that you copied and pasted manually, etc. Even up till a few years ago, it was still quite common to have to check CanIUse to make sure a method was supported everywhere.

It was ES6 that really brought ECMAscript into popularity... this Google Trends graph shows the correlation somewhat, though both are totally dwarfed by "Javascript": https://trends.google.com/trends/explore?date=2004-01-01%202... (and it doesn't go back to the 90s, only 2004).

And the ECMAscript core definition is very narrow, only dealing with core language features and not the greater JS ecosystem, which is how we end up with a bazillion runtimes, TypeScript, third-party libs for everything from components to deep copies to state and routing and testing etc. ECMAscript by itself is super barebones, maybe enough to make a simple serverless func with, but hard to write an entire app in without third party frameworks and libs.

I can't speak to C++ (never worked enough in it), but even PHP by comparison had a wonderful standard library, and de-facto standards in the form of Symfony and Laravel that provided most of the missing use cases. In the JS world it wasn't until AngularJS that we really had something like that (but nobody wanted to use it), and now finally Next.js (which is thankfully super popular). Even then, you had to supplement those on the HTML side with something like Bootstrap, and on the CSS side with something like SASS or LESS. (Thankfully, CSS itself is also getting better these days.)

---------

I don't know that this anecdote really disproves anything you're saying (and it's not meant to), just illustrating that even when standards exist on paper, the ecosystem is of a language is more defined by its real-world usages. And for both JS and its siblings (HTML, CSS, SVG, Canvas)... the journey to get to where we are today was very, very messy and full of a million incompatibilities.

Re:Missing the Point of WebAssembly by steveklabnik on Tuesday January 09, 2024 @04:40PM (#38932524)
> aren't most languages designed and controlled by some relatively centralized organization, whether a company or a nonprofit?

This is a relatively recent development in programming languages. For example, your next sentence:

> Javascript, on the other hand, is a loose standard that different companies kinda sorta adhere to.

This could also describe the history of C. For example, let's look at the rationale document for the first standardization of C: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n802.pdf

I apologize in advance for quoting at length, but I could not decide what should be cut.

---------------------

The X3J11 Committee represents a cross-section of the C community: it consists of about fifty active members representing hardware manufacturers, vendors of compilers and other software development 10 tools, software designers, consultants, academics, authors, applications programmers, and others.

<snip>

The Committee’s overall goal was to develop a clear, consistent, and unambiguous Standard for the C programming language which codifies the common, existing definition of C and which promotes the portability of user programs across C language environments.

The X3J11 charter clearly mandates the Committee to codify common existing practice. The Committee has held fast to precedent wherever this was clear and unambiguous. The vast majority of the language defined by the Standard is precisely the same as is defined in Appendix A of The C Programming Language by Brian Kernighan and Dennis Ritchie, and as is implemented in almost all C translators. (This document is hereinafter referred to as K&R.)

K&R is not the only source of “existing practice.” Much work has been done over the years to improve the C language by addressing its weaknesses. The Committee has formalized enhancements of proven value which have become part of the various dialects of C. Existing practice, however, has not always been consistent. Various dialects of C have approached problems in different and sometimes diametrically opposed ways. This divergence has happened for several reasons. First, K&R, which has served as the language specification for almost all C translators, is imprecise in some areas (thereby allowing divergent interpretations), and it does not address some issues (such as a complete specification of a library) important for code portability. Second, as the language has matured over the years, various extensions have been added in different dialects to address limitations and weaknesses of the language; these extensions have not been consistent across dialects.

One of the Committee's goals was to consider such areas of divergence and to establish a set of clear, unambiguous rules consistent with the rest of the language. This effort included the consideration of extensions made in various C dialects, the specification of a complete set of required library functions, and the development of a complete, correct syntax for C.

The work of the Committee was in large part a balancing act. The Committee has tried to improve portability while retaining the definition of certain features of C as machine-dependent. It attempted to incorporate valuable new ideas without disrupting the basic structure and fabric of the language. It tried to develop a clear and consistent language without invalidating existing programs. All of the goals were important and each decision was weighed in the light of sometimes contradictory requirements in an attempt to reach a workable compromise.

---------------------

In general, standards that follow this path, codifying existing practice, that serve to coordinate interest between various actors, tend to work better than specifications that are written up-front and then followed by implementation. You can see this operating in a smaller way within current standards bodies and organizations, as you yourself alluded to with "relatively centralized."

> Javascript became the lowest common denominator, winning out not because it was better than say Java or ActiveX or Flash or whatever. It was just commonly available.

This statement is shockingly similar to what people say about C, as opposed to various other languages that were in the same space around the same time.

Re:Missing the Point of WebAssembly by gear54rus on Tuesday January 09, 2024 @04:34PM (#38932427)
That's exactly what makes it powerful and ensures it's bright future. It is not controlled by one entity and non-working approaches die out by themselves and there's constant innovation. Calling that a mess is just personal problems.
Re:Missing the Point of WebAssembly by moralestapia on Tuesday January 09, 2024 @05:02PM (#38932843)
Huh? What?

Nothing's more standard than Javascript these days. Not even close. It runs the same way on billions of devices across virtually all existing architectures.

Re:Missing the Point of WebAssembly by yencabulator on Tuesday January 09, 2024 @07:42PM (#38934581)
This is how a language can be a mess:

    [] + [] = ''
    [] + {} = '[object Object]'
    {} + [] = 0
    {} + {} = NaN
    Array(16).join('wat' - 1) + ' Batman' = 'NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN Batman'
https://www.destroyallsoftware.com/talks/wat
Re:Missing the Point of WebAssembly by mardifoufs on Tuesday January 09, 2024 @09:32PM (#38935412)
You can find examples like these for basically every single language.
Re:Missing the Point of WebAssembly by lifthrasiir on Tuesday January 09, 2024 @11:48PM (#38936311)
This is misleading, as the original talk executed them in the statement context where the preceding `{}` is an independent statement. `({} + [])` etc. are much more consistent.
Re:Missing the Point of WebAssembly by jauntywundrkind on Tuesday January 09, 2024 @02:45PM (#38930969)
While I don't necessarily agree with the unnecessary, unsupported, casual, & cheap (provided with zero substantiating/contestable support) contempt culture here ("unshackle the web from the mess that is JavaScript", "places that don't really need these problems to be solved")...

WebAssembly component-model is being developed to allow referring to and passing complex objects between different modules and the outside world, by establishing WebAssembly Interface Types (WIT). It's basically a ABI layer for wasm. This is a pre-requisite for host-object bridging, bringing in things like DOM elements.

Long running effort, but it's hard work and there's just not that many hands available for this deep work. Some assorted links with more: https://github.com/WebAssembly/component-model https://www.fermyon.com/blog/webassembly-component-model https://thenewstack.io/can-webassembly-get-its-act-together-...

A preview-2 should be arriving sometime somewhat soon.

It's just hard work. It's happening. And I think the advantages Andy talks to here illuminate very real reasons why this tech can be useful broadly. The ability to have plugins to a system that can be safely sandboxed is a huge win. That it's in any language allows much wider ecosystem of interests to participate, versus everyone interested in extending your work also having to be a java or c++ or rust developer.

Re:Missing the Point of WebAssembly by davexunit on Tuesday January 09, 2024 @03:12PM (#38931397)
The type system introduced in Wasm GC allows sharing data between the host and other modules and is usable right now. DOM access is possible and being demonstrated in several language implementations.
Re:Missing the Point of WebAssembly by schemescape on Tuesday January 09, 2024 @04:30PM (#38932377)
I saw you mention this in a previous post, but I can’t find an example. Do you have one handy? What are the limitations?

Edit: is this it? https://www.spritely.institute/news/building-interactive-web...

Edit again: apparently I had seen this before, since I upvoted its HN submission. Oops! https://news.ycombinator.com/item?id=38477602

Re:Missing the Point of WebAssembly by davexunit on Tuesday January 09, 2024 @04:37PM (#38932467)
Yup, that's one of the examples! And here's another: https://spritely.institute/news/scheme-in-scheme-on-wasm-in-...
Re:Missing the Point of WebAssembly by singularity2001 on Tuesday January 09, 2024 @03:17PM (#38931475)
are you sure? the last time I checked JavaScript was NOT able to access Wasm/GC objects
Re:Missing the Point of WebAssembly by paroneayea on Tuesday January 09, 2024 @03:35PM (#38931730)
Yes, we have made use of JS invoking WASM-GC managed Scheme objects in our Hoot demos at Spritely.
Re:Missing the Point of WebAssembly by singularity2001 on Tuesday January 09, 2024 @03:44PM (#38931840)
In Chrome 120 I still get:

TypeError: WebAssembly objects are opaque

When trying to read/write WASM-GC objects in JS.

Re:Missing the Point of WebAssembly by titzer on Tuesday January 09, 2024 @05:04PM (#38932863)
Wasm modules have been able traffic in (opaque) host references since the reference-types proposal landed several years back.
Re:Missing the Point of WebAssembly by davexunit on Tuesday January 09, 2024 @05:14PM (#38932994)
But GC ref types have made it practical.
Re:Missing the Point of WebAssembly by logicprog on Tuesday January 09, 2024 @10:22PM (#38935728)
> While I don't necessarily agree with the unnecessary, unsupported, casual, & cheap (provided with zero substantiating/contestable support)

What I personally find annoying is the debate-bro attitude that expects every statement anyone makes that you disagree with to be made with an entire supporting argument with multiple examples or citations, especially when the general reasons someone might believe that statement are pretty well known. And expressing their opinion on thr quality of JS wasn't unnecessary, it was literally necessary to explain why they are excited for the potential of WebAssembly.

> contempt culture

Oh that essay. Thinking a technology is bad and stating so, even making fun of it a bit, is not inherently mocking or degrading the skills or legitimacy of the people that use it. The author of that essay was right we shouldn't mock or degrade the skills (or other aspects) of anyone, but they can't seem to realize that making fun of a language isn't tantamount to mocking the people that use it, and if someone feels that's the case, maybe they should learn to separate their ego / sense of self worth from the tool they use, so we avoid language or editor flame wars by way of greater maturity, instead of by way of walking in eggshells. Especially since languages can be better or worse. Seeking a kinder, more inclusively spirited community is commendable, but expecting every opinion about language quality to be either kept in or perfectly sourced is a blind and misplaced excess of enthusiasm in that direction. And I say this as someone who supports things like DEI and CoCs.

For myself, I think JavaScript has a lot of warts, but not really any more than a lot of popular languages, and the core of it is very well designed indeed, but I just personally don't prefer to use it. Just in case you were going to assume I'm responding this way because I want to be able to make fun of JS. I don't. I just find this style of thinking annoying.

Re:Missing the Point of WebAssembly by zengid on Tuesday January 09, 2024 @04:29PM (#38932360)
I think once WasmGC is finished up, that will make shipping a VM inside a VM more viable. Opening up direct access to the DOM would be cool, but if it were up to me, I'd just skip it and render everything inside a <canvas/> and avoid all of the "build an application on top of a document format" crap that makes web apps so weird to make.
Re:Missing the Point of WebAssembly by munificent on Tuesday January 09, 2024 @05:44PM (#38933355)
> if it were up to me, I'd just skip it and render everything inside a <canvas/>

That's very tempting, but you lose a lot if you do that, especially around text:

* Accessibility for screen readers, etc.

* The easy ability to select text, copy/paste between other apps, etc.

* Line splitting

* Support for multiple languages, RTL, and all their other rendering quirks.

Canvas has some text APIs, but they are fairly rudimentary. It's a hard problem.

Re:Missing the Point of WebAssembly by etimberg on Tuesday January 09, 2024 @10:05PM (#38935635)
> Canvas has some text APIs, but they are fairly rudimentary

That's an understatement for sure. `measureText` is not even close to feature parity with where windows apis were 25 years ago.

Or something like text underlines has to be done entirely manually.

Re:Missing the Point of WebAssembly by zengid on Wednesday January 10, 2024 @02:11PM (#38941963)
I completely agree, and these are required features for a full app that is planning to reach the world.

It requires a lot of extra work, but real world apps like Figma [0] are rendering directly to the canvas, and frameworks like Flutter offer support for canvas rendering (via Skia's CanvasKit) [1] [2].

I guess my point is that if someone is using WASM to ditch JavaScript, why stop there? Ditch the DOM and CSS too! Render all of the graphics with OpenGl or WebGPU!

There is a class of applications that I want to explore that would be better suited to by doing just that. I don't believe every app should do that, just that for what I want to build, that's where I'm looking at going (hence my "if it were up to me" comment above).

[0] https://www.figma.com/blog/building-a-professional-design-to...

[1] https://docs.flutter.dev/platform-integration/web/renderers

[2] https://skia.org/docs/user/modules/canvaskit/

Re:Missing the Point of WebAssembly by noman-land on Tuesday January 09, 2024 @04:45PM (#38932582)
Not a very accessible solution.
Re:Missing the Point of WebAssembly by zengid on Tuesday January 09, 2024 @05:42PM (#38933321)
It can be! I think that's the number 1 response when anyone wants to actually make a better platform. Projects like AccessKit are a really great step in the right direction https://github.com/AccessKit/accesskit
Re:Missing the Point of WebAssembly by noman-land on Tuesday January 09, 2024 @06:16PM (#38933729)
Cool, thanks for the share. I will check it out.
Re:Missing the Point of WebAssembly by 0x457 on Tuesday January 09, 2024 @09:05PM (#38935239)
> render everything inside a <canvas/> and avoid all of the "build an application on top of a document format" crap that makes web apps so weird to make.

We tried this with flash already. It has the same issues. Browsers provide _a lot more_ than just rendering your html+css. There are cases where it makes sense, but generally, it's a terrible idea. It will be like trying to make a visual novel using youtube in-video links.

Re:Missing the Point of WebAssembly by moralestapia on Tuesday January 09, 2024 @04:58PM (#38932766)
>unshackle the web from the mess that is JavaScript

well_thats_your_opinion.jpeg

Javascript is great and the web became what it is today because of it, not in spite of it.

Re:Missing the Point of WebAssembly by ilaksh on Tuesday January 09, 2024 @08:22PM (#38934904)
A lot of use cases are applications that don't technically require a DOM but maybe just the ability to copy and paste text.

The biggest thing is some kind of graphics capability.

What I think happened, if you look at the web assembly design discussions, is that they made the initially correct decision to limit the scope to be more manageable, but then over the years that decision became something of a religion and even a strange badge of honor.

"Web assembly is not meant to replace JavaScript". It certainly is challenging to try to standardized on anything like device input or graphics APIs, but after say three years, competent and sane designers obviously should have been working on that.

Maybe I am a conspiracy theorist (I am) but I sometimes suspect that Google has deliberately limited the scope of web assembly in order to maintain the control that the dominance of Chrome provides them. Because if things like keyboard/mouse and graphics had some type of web assembly standard, then it would be easy for different runtimes to support them. Then before you know it, you don't need the browser for most things, you can just use your favorite web assembly runtime.

I will go so far as to suggest that this is an antitrust issue and that a technically competent government (of which maybe non exist so far) would have somehow forced the development of an evolvable shared standard like web assembly that is not missing important pieces like graphics.

I see web assembly as the obvious successor to Java. It's been held back by some strange psychology and maybe even intentional sabotage.

Re:Missing the Point of WebAssembly by camgunz on Tuesday January 09, 2024 @08:27PM (#38934945)
The main problem is that either you compile a WASM binary or you serve a big language runtime (itself compiled to WASM) all the time: this is what you'd have to do if using C# or Java for example (maybe you can use TeaVM, but maybe you can't).

For some reason browsers didn't want to "balkanize the web" for the really good reason of supporting multiple languages, they wanted to do it for very petty reasons like WebMIDI or wildly differing implementations of LocalStorage (e.g. how much you can put in there), or non-overlapping support for video codecs, etc etc etc.

Re:Missing the Point of WebAssembly by raxxorraxor on Wednesday January 10, 2024 @04:19AM (#38938082)
While there is valid criticism of JS, I am not sure if I really want binary blobs executed in my browser.

Sure, for applications that really need to strip the overhead of a scripting language, it is very welcome. But for the average website? Not sure about it...

And security is another matter, there is a reason the WebAssembly sandbox is so restrictive.

Webassembly is awesome, but the solution needs to fit the problem.