News for hackers. Stuff that matters.
Re:Why Rust? by traceroute66 on Tuesday October 18, 2022 @09:20AM (#33246680)
> There is a reason why JS was invented.

I disagree.

As I see it, JS was invented as a browser utility, as the name implies "script", i.e same as shell script languages such as BASH, for doing small amounts of interactive stuff.

What JS has morphed into is a Jeckyll & Hyde monstrosity. Frontend devs now routinely dump 200kb+ of junk down the pipe at people's browsers because its somehow "better" to dump the processing/rendering on the user's desktop instead of server side.

And then there's the monstrosity of server-side JS. I think few people can argue that JS was ever supposed to be server-side. Things like Node are basically square-pegging JS into that round hole.

Re:Why Rust? by EamonnMR on Tuesday October 18, 2022 @09:38AM (#33246930)
Of course it's better to do processing client side. You pay for server side compute, you don't pay for client side compute.
Re:Why Rust? by horsawlarway on Tuesday October 18, 2022 @09:45AM (#33247031)
I think you're failing to address the elephant in the room:

The browser is simply the single best application distribution method humanity has ever created. Full stop.

There are literally no other tools that give anywhere close to the same benefits.

So 200kb of scripts might seem "HUGE!" to someone who's thinking about the web as a tool for distributing static information (blog distribution). But in the context of applications 200kb is ridiculously small.

When was the last time you installed an application on Windows/Mac/Android/iOS that was under a single MB?

Yet you install (& run) applications ALL DAMN DAY on the web, without a thought or care.

Things that used to come with 100MB+ installers? Those are web apps now. They serve you 200kb and load in less than a few seconds.

Ex: Outlook used to be a mail client you installed. The installer was several hundred MBs, and it took 10+ minutes to run. Now you point your browser at outlook.com and you get a nearly identical experience.

That spreadsheet app? Just a sheets.google.com away. Loads in seconds - using JS with a tiny payload.

Music player? It's a website now. JS.

See my point?

So is JS a monstrosity? For blogs, sure. For apps? Hell no. It's fucking amazing.

Re:Why Rust? by traceroute66 on Tuesday October 18, 2022 @10:31AM (#33247780)
> See my point?

No.

Because your point only works if you make (at least) two prior assumptions which are not always true.

Number one you assume everyone has high-speed broadband and "unlimited" 5G on mobile. This might well be the case in many parts of the Western world. But I can point you to a number of rural areas in the Western world and beyond that, in Africa and Asia where this assumption falls flat.

Number two, given most developers use JS to outsource the processing duties, you assume everyone has a half-decent computer. Many people use cheap laptops with lousy Celeron processors and a minuscule amount of RAM, likely also with an ancient browser that has not been updated for ages. Their experience of a browser-app will likely be very different to the cool-kid developer sitting on his bean-bag in a fancy office coding on a spec'd out beast of a machine.

Re:Why Rust? by lnenad on Tuesday October 18, 2022 @11:18AM (#33248617)
What is your counter point with these statements? That having everything in canvas negates these potential issues? That having a native application negates them?

In an ideal scenario of application design, these two assumptions apply as well. So I don't think there is any merit in mentioning them as they're not counter points in any way.

Re:Why Rust? by masklinn on Tuesday October 18, 2022 @09:50AM (#33247109)
> So is JS a monstrosity? For blogs, sure. For apps? Hell no. It's fucking amazing.

That web application delivery is "fucking amazing" doesn't mean javascript is. Javascript very much is not.

What javascript is, is the only complete option until wasm is way more fleshed out than it currently is.

> Things that used to come with 100MB+ installers? Those are web apps now. They serve you 200kb

With an entire browser and server farm to do that.

> and load in less than a few seconds.

Instead of instantaneously.

> That spreadsheet app? Just a sheets.google.com away. Loads in seconds - using JS with a tiny payload.

10% the functionality, 20% the performance, at twice the heft. Amazing.

> Music player? It's a website now. JS.

Your music library? Doesn't exist now.

Re:Why Rust? by devmor on Tuesday October 18, 2022 @11:24AM (#33248732)
Your point and explanation are completely disjointed from eachother.

Javascript is not the sole domain of small executables, its not even its primary feature - hell, one of your own examples isn't even very good. Outlook loads nearly 30MB of javascript immediately when you load your inbox, and they update it nearly every other day so you end up downloading hundreds of megabytes just to read your email every single week instead of just once.

Re:Why Rust? by veidr on Tuesday October 18, 2022 @11:33AM (#33248921)
For blogs, sure, JavaScript is "fast enough".

But in the context of applications, JavaScript is slow as dog shit.

It takes "seconds" to open my spreadsheet? That is an absolutely deplorable regression.

Personally, I'm fine with 200KB initial downloads, sure that's great and I don't mind repeating them. (But, also don't care about 50MB or even 500MB downloads that I only do once.)

But for the browser to really become the "single best application distribution method humanity has ever created" it needs to be capable of delivering software that executes efficiently or else it is regresssion to barbarism by a thousand cuts. Not just the putrid UX, but we now understand that slow, inefficient code also cooks the planet and destroys various life forms.

I work at a company that uses Google Sheets. So yeah, it does often take seconds to open a document. And I've spent way more time waiting for those sheets to load over the past 5 years than I have waiting for software installers.

And many web apps bog down and lag behind even just typing, because they are doing some (trivial) computation on every keystroke. It doesn't have to be that way, but it often is... because JavaScript.

I'm also bullish on the browser's future as an app-delivery channel — but that is only because I think doing it without JavaScript will become easy, and thus common.

JavaScript is relevant because of the browser, not the other way around.

Re:Why Rust? by zozbot234 on Wednesday October 19, 2022 @03:05AM (#33258668)
> it needs to be capable of delivering software that executes efficiently or else it is regresssion to barbarism by a thousand cuts.

WebAssembly executes efficiently, it keeps its overhead within a small multiple of natively compiled binaries which is totally par for the course for any JIT-compiled intermediate code. You can write slow and inefficient code in any language, but Rust makes it a bit easier to do things the efficient way.

Re:Why Rust? by veidr on Wednesday October 19, 2022 @03:27AM (#33258810)
Yeah, that's why I remain optimistic about the browser's future. My ranting was mainly about JavaScript itself.

We are already seeing real world web apps using WASM. (What I have seen is indeed mostly Rust, but in theory there are lots of other languages that can already, or will be able to, play in that same sandbox.)

The other fun thing about WASM is that there are already a bunch of ways to run it on the server (including "at the edge"). That makes it really easy to chop apps up into pieces that run in the browser, or run elsewhere.