News for hackers. Stuff that matters.
Re:Thoughts on Svelte(Kit), one year and 3B requests later by andsoitis on Thursday June 22, 2023 @09:36AM (#36431958)
> you can't code anything without async

I'd like to understand what you mean by this. As soon as you introduce network requests in a system, don't you need to deal with asynchrony?

Re:Thoughts on Svelte(Kit), one year and 3B requests later by aobdev on Thursday June 22, 2023 @10:23AM (#36432634)
Everything in JS started with callbacks, then promises came on to the scene with libraries like Bluebird, then the async/await syntax was added to the spec. The language was always able to handle concurrency but it was a long road to the current state.
Re:Thoughts on Svelte(Kit), one year and 3B requests later by ehnto on Thursday June 22, 2023 @11:41AM (#36433891)
You can just wait for the network request to finish before continuing. Many actions require it anyway.

Asynchronous code should be intentional and deliberate in my opinion, but in modern JS/Node it is the default which leads to all kinds of crazy workarounds, callback hell and race conditions. Node has the same issue PHP had now, where green devs will crank out code without realising they need to be watching out for these things.

Is it cool that a .forEach loop could be async? Heck yeah, should it be the default? The shit people write around .forEach loops suggests, maybe not!

Re:Thoughts on Svelte(Kit), one year and 3B requests later by c-hendricks on Thursday June 22, 2023 @03:27PM (#36437415)
What's not deliberate about marking a function as `async`, and marking calls that need to be awaited with `await`?

Callback hell? When was the last time you gave an honest effort into JavaScript?

Re:Thoughts on Svelte(Kit), one year and 3B requests later by belmont_sup on Thursday June 22, 2023 @11:50PM (#36442575)
He still has a point. Go code and similar languages hide the concurrency. You write synchronous looking code most of the time, but underneath, libraries and runtimes ensure you’re running concurrently.
Re:Thoughts on Svelte(Kit), one year and 3B requests later by ehnto on Friday June 23, 2023 @03:30AM (#36443879)
Most libraries are async and some standard lib stuff is unexpectedly async as well, so you are often handling async concerns even if what you're writing is better syncronous.

My team and I don't write callback hell, it's just a very common pitfall and you still see it all the time. You can't bubble wrap everything I suppose.