News for hackers. Stuff that matters.
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.