So the caller must await too. Ah no, rather return-immediately-with-a-fucking-promise. And so the caller's caller too and so on.

Now you hardly have a function call not preceded by await. Ask yourself: why is that not the default? For the other case, lets invent the keyword **getlost** to get the functionality we now have if we forget await.

😡 Sorry for venting. It is a relief.

#javascript #typescript #async #await #asyncawait

Because that's what it actually is. It does not wait at all. Quite contrary, it returns immediately, throwing the rest of the function code into a pool of stuff to be executed some day.

And the caller? Getting control back before things are really done? Without extra tooling the dev easily misses that the called async did exactly nothing and lets proceed the code as if. Fail!

2/n

#javascript #typescript #async #await #asyncawait

TypeScript is fun, but often I hate the JavaScript async/await crap.

Background: https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/

Async is like mold spreading through the code base. On top of it: why is it called **await** and not **return-immediately-with-a-fucking-promise**? ...

1/n

#javascript #typescript #async #await #asyncawait

What Color is Your Function? – journal.stuffwithstuff.com

Как старый роутер съел 2.5 ГБ ОЗУ в моей вкладке, или cетевой инфаркт асинхронного кода

Интро Это история о том, как «кривой» роутер научил меня смотреть на память браузера иначе. Есть вкладка с ИИ-чатом, есть WebSocket/Streaming, есть обычный i5. И есть момент, когда все это превращается в кирпич: вкладка раздувается до гигабайтов, процессор залипает, страница оживает только на пару минут после перезагрузки. Лид Проблема оказалась не в нейросетях и не в JS. Виновник — старый домашний роутер, который не вывозил IPv6 и фрагментацию. Итог — застрявшие пакеты, нарастающий буфер в браузере и тысячи незавершенных async/await -машин в памяти. TL;DR - Вкладка с WebSocket раздувается из-за сетевых затыков. - Роутер ломает MTU/IPv6, пакеты зависают, bufferedAmount растет. - Асинхронные цепочки не завершаются и копятся в Heap. - Фикс: MTU 1400 + отключение IPv6. - В коде: мониторинг bufferedAmount , таймауты и AbortController . Симптом - Вкладка с ИИ-чатом пухнет до 1–2.5 ГБ. - CPU уходит в 100%, интерфейс замирает. - Перезагрузка помогает на 5 минут, дальше все повторяется.

https://habr.com/ru/articles/988398/

#websocket #javascript #network #performance #asyncawait #memory

Как старый роутер съел 2.5 ГБ ОЗУ в моей вкладке, или cетевой инфаркт асинхронного кода

Интро Это история о том, как «кривой» роутер научил меня смотреть на память браузера иначе. Есть вкладка с ИИ-чатом, есть WebSocket/Streaming, есть обычный i5. И есть момент, когда все это...

Хабр

How do structured and unstructured tasks behave differently when cancelled in Swift? This breakdown of 𝑎𝑠𝑦𝑛𝑐/𝑎𝑤𝑎𝑖𝑡 task lifetimes clarifies cancellation behavior in Swift's concurrency system.

🔗: https://tanaschita.com/swift-async-tasks-cancellation-asyncstream by Natascha Fadeeva (@tanaschita)

#Swift #Concurrency #AsyncAwait

Understanding task cancellation and lifetimes in Swift concurrency

Swift automatically manages the lifetime and cancellation of structured tasks, but unstructured and detached tasks behave differently. In this article, we look at how cancellation propagates, when tasks outlive their scope, and how to manage them safely.

Confused about when to use 𝑇𝑎𝑠𝑘.𝑠𝑙𝑒𝑒𝑝() versus 𝑇𝑎𝑠𝑘.𝑦𝑖𝑒𝑙𝑑()? Wesley de Groot clears up the confusion, explaining the critical difference between fixed-duration suspension (sleep) and voluntary control yielding (yield). Essential knowledge for managing Swift concurrency effectively.

🔗: https://wesleydegroot.nl/blog/task-sleep-vs-task-yield-the-differences-explained by 𝗪𝗲𝘀𝗹𝗲𝘆 𝗱𝗲 𝗚𝗿𝗼𝗼𝘁

#Swift #Concurrency #AsyncAwait

Task.sleep() vs. Task.yield(): The differences explained - Wesley de Groot

Task.sleep() vs. Task.yield() The differences explained What is Task.sleep()? With Task.sleep(), you can suspend the execution of a task for a specified duration. This is useful when you want to introduce a delay in your asynchronous code, such as waiting for a certain condition to be met or simulating a long-running operation. What is Task.yield()? With Task.yield(), you can voluntarily yield control back to the ...

🛠️🎉 #Zig finally got its Async/Await back! 🙄 The world's most anticipated feature for a #language no one's heard of—because, obviously, we don't have enough async/await in other languages. 😂 But hey, #compiling from the master branch makes you a real programmer, right? 🤓✨
https://charlesfonseca.substack.com/p/asyncawait-is-finally-back-in-zig #AsyncAwait #Programming #DeveloperHumor #HackerNews #ngated
Async/Await is finally back in Zig

What changed, why it matters, and how to use the new API.

Charles Fonseca's Substack
Async/Await is finally back in Zig

What changed, why it matters, and how to use the new API.

Charles Fonseca's Substack

How do you manage runaway async tasks in SwiftUI?

Learn both automatic and manual approaches for properly cancelling async work, helping you build more responsive and memory-efficient SwiftUI apps.

🔗: https://tanaschita.com/swiftui-cancel-async-work by @tanaschita

#SwiftUI #AsyncAwait #Concurrency

#TIL about #ResonateHQ;

https://www.resonatehq.io/

No, not the moribund music streaming co-op, the developers describe their project as;

"An open-source implementation of Distributed Async Await."

An open protocol described in a diagram here;

https://www.resonatehq.io/distributed-async-await

... which extends the pre-existing Async Await.

(Yes, I learned about all of this for the first time today and I'm still not entirely sure what it is).

#AsyncAwait #DistributedAsyncAwait

Resonate

Dead simple — Killing the complexity of distributed systems.