Ask HN: Does any programming language have inline offline async calls?
It got me wondering if there is any way to do that in actual code. I would want to write something like
doSomething();
const result = await offline someVeryVeryLongRunningThing();
doSomethingElse();
Then behind the scenes someVeryVeryLongRunningThing launches its own process for doing its thing, using polling, events, whatever it wants. (It's a specially written function that supports async offline.) The main process saves its state to disk somewhere and terminates. Then when someVeryVeryLongRunningThing finishes (or fails), the original process is relaunched with the state and call stack that were there before, and carries on where it left off.Obviously things like open sockets and file handles will be lost. But if it could at least retrieve those parts of state that are just data that would still leave a lot of useful use cases. And this is something a compiler could catch.
Now of course you can implement it yourself in all sorts of ways, but there would be a lot of boilerplate and the code would not look anything like the above. My question is if there's anything available for any mainstream language today that abstracts the complexity away to look remotely like the code snippet above (which is also what the no-code solution would look like it it was code).