| ▲ | seabrookmx 12 hours ago |
| It's odd that the async/await syntax _exclusively_ uses threads under the hood. I guess it makes for a straightforward implementation, but in every language I've seen the point of async/await is to use an event loop/cooperative multitasking. |
|
| ▲ | sestep 10 hours ago | parent [-] |
| Noob question: if it just compiles to threads, is there any need for special syntax in the first place? My understanding was that no language support should be required for blocking on a thread. |
| |
| ▲ | maxbond 4 hours ago | parent | next [-] | | One advantage is that it gives you the opportunity to move to a more sophisticated implementation later without breaking backwards compatibility (assuming the abstraction does not leak). | |
| ▲ | gmueckl 10 hours ago | parent | prev [-] | | Async/await should do a little more under the hood than what the typical OS threading APIs provide, for example forwarding function parameters and return values automatically instead of making the user write their own boilerplate structs for that. |
|