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

It is a false security. If you call a function either you know what it does (so in lua you would know whether it call yield) or you don't and it could still be calling arbitrary code, so you have to code defensively and think about reentrancy. The only reason for await is that it normally needs to save less state (a single frame) than a full coroutine yield (a whole stack).

Also lua-like stackfull coroutines don't prevent firing multiple asynchronous operations at the same time (like in your example), they only make the waiting much more peasant.



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

Search: