News for hackers. Stuff that matters.
Re:WebAssembly: A promising technology that is quietly being... by worik on Wednesday May 22, 2024 @03:21PM (#40445085)
OT but this...

> I strongly believe that async is the new billion dollar mistake of the 2020's: a design aberration that wasted so much developers time that it had cost billions of dollars to companies.

Yes. Nicely put

Re:WebAssembly: A promising technology that is quietly being... by amw-zero on Wednesday May 22, 2024 @04:02PM (#40445679)
What does this even mean, how can you do any form of modern computation without async?
Re:WebAssembly: A promising technology that is quietly being... by MrDarcy on Wednesday May 22, 2024 @04:31PM (#40446081)
async / await as they exist in JavaScript, Python, and Rust aren’t the only way to execute tasks concurrently.
Re:WebAssembly: A promising technology that is quietly being... by amw-zero on Wednesday May 22, 2024 @05:40PM (#40446966)
That’s what I’m asking - did the comment mean that the async/await pattern is bad, or that asynchronous programming in general is bad?
Re:WebAssembly: A promising technology that is quietly being... by worik on Friday May 24, 2024 @06:35PM (#40471104)
asynchronous programming is the bee's knees, and my preferred mode

Asyc/await pretends to be synchronous and gets all tied in horrible knots when the sunk costs mount

Writing IO without blocking has always been second nature to me

Re:WebAssembly: A promising technology that is quietly being... by eureka-belief on Thursday May 23, 2024 @03:28AM (#40451601)
But they are a darn convenient mental model if you’re just trying to do some basic async. The alternatives are harder to wrap your head around. Unless I’m missing some other cool pattern.
Re:WebAssembly: A promising technology that is quietly being... by worik on Friday May 24, 2024 @06:36PM (#40471109)
> Unless I’m missing some other cool pattern.

Explicit state machines

Re:WebAssembly: A promising technology that is quietly being... by mbStavola on Wednesday May 22, 2024 @03:45PM (#40445443)
Completely disagree.

Async as a paradigm has probably created billions of dollars in that it's allowed many many many developers to reasonably scale beyond what they could've otherwise.

Re:WebAssembly: A promising technology that is quietly being... by prerok on Wednesday May 22, 2024 @04:17PM (#40445876)
And I disagree with your disagreement :)

Just some background first: one of the billion dollar mistakes is the null pointer which is a special value to be assigned to any type. It was inherent in the first high (today considered low) level languages. Those languages (C most importantly, then Java and nowadays even Go) enabled many more programmers to create programs and they likely would not have been able to, had they been forced to write assembly. So, it's a billion dollar mistake within a trillion dollar revenue.

The async now solves a similar practical problem but in the space of prallelism (or concurrency, in some cases). A different approach might have given us the same result, but a different implementation that might be just as approachable.

Optionals and Results have given us a better way than to have nulls, and maybe golang style channels could have given us a better way to handle async?

Re:WebAssembly: A promising technology that is quietly being... by anakaine on Wednesday May 22, 2024 @04:16PM (#40445857)
Agree wholesale. I've got a complex data reader built on a single server that receives tens of thousands of requests a day, and most tend to happen in a few hour window. Async was super important to scale to user requests by allowing non-blocking calls to not get captured behind blocking ones.
Re:WebAssembly: A promising technology that is quietly being... by tommiegannert on Wednesday May 22, 2024 @04:44PM (#40446285)
I think GP is arguing that green threads e.g. in Go is a better way to structure the same thing.
Re:WebAssembly: A promising technology that is quietly being... by worik on Thursday May 23, 2024 @04:44AM (#40452177)
No. I had a nasty experience with Typescript's async/await and I am annoyed

I find async/await very confusing. It as one thing pretending to be another

I prefer my paradigms simple and straight

Async await is deceptively simple but very wiggly. Not straight at all. Loads of magic fairy dust obscuring what's really happening

It is helpful until it isn't and then it's very unhelpful

Re:WebAssembly: A promising technology that is quietly being... by aixpert on Wednesday May 22, 2024 @11:41PM (#40450227)
Wait they promised to not adopt the cancerous function coloring approach in wasm. Please tell me they didn't follow the dark path of JS
Re:WebAssembly: A promising technology that is quietly being... by leucippe on Friday May 24, 2024 @02:37AM (#40463478)
The plan is to support async without function colouring.

I recommend this talk by Luke Wagner on async plans in WASI 0.3 (https://youtu.be/y3x4-nQeXxc) for background on how it will work.

To summarise, from an API perspective, the caller and callee won't know if the other is async or not. When calling async from non-async, an event loop is inserted at link-time and it blocks.* When calling non-async from async, the callee will get suspended if it tries to do blocking IO. That still leaves the problem of long-running compute without IO in a non-async context, but at least you're not wasting CPU time in that scenario.

* If the host runtime already has an event loop, I assume the callee will get added to that.