SkiFire13
Joined 5 years ago
Joined 5 years ago
This is incorrect. You can easily call that flow from a blocking function, just call it in a loop.
What normally prevents a blocking function from "simply" calling an async one is that the async function needs runtime support for certain operations: the simpliest of which is suspending until it's notified, with more complex ones being async I/O primitives.
A Sans-IO library needs none of these. It can simply be called in a loop and as long as the caller provides more inputs it will make progress. An blocking caller can simply call the std's `Read::read` and pass the received bytes in, while an async caller can use async I/O primitives to do the same, and since the Sans-IO library yields once it finishes consuming the current input it won't block the async library either.
It's the best of both world but as always you have a tradeoff, and in this case it's the ability to express the state machine as if it was a straightforward function. Maybe once Rust gets support for generic coroutines this will get better.
The stopping distance for a train this size and this fast is around 2km. Good luck estimating that by sight. There is a reason the normal protocol has a 40km/h max speed for traveling according to line of sight, which the driver was told wasn't needed.
People don't trust other people making little changes to existing software, who will ever be ok with rebuilding it from scratch?
I suspect this started stagnating in Q3/Q4, which is why they're looking to IPO now.
And they likely won't be spending them on something without ZDR like Fable 5.
Some dev or company might pay for a subscription (or self-host an open weight model) for maintaining that Photoshop clone, but the millions of people that were paying for Photoshop could simply stop paying and use the free/cheap alternative.
An generic future is much harder to be called like this. You need to to create wakers and if you don't properly handle them you'll busy loop. You also need to provide the exact runtime the future needs for its I/O.
> so long as you're okay with none of your other flows being able to make progress in the meantime
And isn't that what blocking code does all the time?
> ‘The best of both worlds’ means that it shares the advantages of both
If you look at it from the perspective of a caller:
- you can easily use it from blocking code without needing a runtime - you can easily use it from async code without blocking the executor
As such it does provide the best of both worlds to the caller.
It is true that it's the worst of both worlds for who is writing the Sans-IO library though.
> or, as we used to call it, pure functional programming
You can for sure describe this as "pure" and "functional", but I bet most people think of a different paradigm when talking about pure functional programming.