Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've run into this in code that completes synchronously in the common case, but falls back to an async implementation - think caching. The simple way to write this creates a state machine even on the synchronous path.

It's possible to work around this efficiently by pulling the async code into a separate method and using ValueTask for the outer method return type.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: