Recent submissions

Comment · 1 year ago
> In my experience simple blocking code is incredibly misunderstood.

I don't think so. You can't even implement a full-duplex protocol properly with sync IO since reading and writing can't happen at the same time on the same thread. Splitting them to different threads also won't help since accessing shared state requires synchronization with e.g. mutex that kills again simultaneous reading and writing.

Comment · 2 years ago
> In actual real applications it is not always possible

This depends on what are your expectation. IO operations must suspend to wait for data read and writes, therefore it is not possible to avoid Async/Await. In other cases you might have multiple tasks depending on a specific IO operation, for example, one connection to a database that is used by multiple HTTP sessions, here it is also not possible to avoid Async/Await because those sessions are bound to an IO operation.

The real problem however comes when tasks that can complete synchrously are implemented with an asynchronous interface, for example

  message = Await websocket.read(socket, buffer, ...)
This is a poor design because a socket read can pull multiple messages from the kernel buffers into user space and there should be a way to consumed them without Await. Many libraries however don't for watch this problem and that results in the everything is async madness.
Comment · 2 years ago
Only in poorly designed code you have problems like this where Async Await goes viral. It can be avoided by spiting libraries into an IO part that uses Async/Await and a protocol part that is sans-io. Using async code to access data that is already in the application memory is inefficient and should be implemented synchronously with regular functions instead of asynchronously.
Comment · 2 years ago
Here is a low hanging fruit for governments around the world fighting low birth rates. Allow your people to work from home and they will start having more babies, simplle as that. I am my wife had to switch jobs just so we could work more from home, an unnecessary annoyance.
Comment · 2 years ago
I wonder how did they shared the meat with the rest of the group after chasing down the prey for an hour in random directions.
Comment · 3 years ago
Implementing full-duplex protocols asynchronously is much simpler.
Comment · 3 years ago
So why rotten meat smells terrible and a steak delicious? Why would we evolve that perception of something that nutritious and which could prevent me from starving. Why my nose keeps telling me to keep away from rotten meant?
Comment · 3 years ago
Comment · 3 years ago
Comment · 4 years ago
Senders and Receivers is the next big thing Eric is delivering to C++, stay tuned.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton