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

Thanks for the example. Just to clarify, it appears that you used syncify.revert(getCallbackText) to to create a callback from a synchronous function in order to log the final result.

So it looks like Syncify.js evaluates the parent getCallbackText() function each time that one of its child callbackTest("Alice") or callbackTest("Bob") functions fire. Conceptually it replaces instantiations of callbackTest() with their return values. So on the final pass there are no more child functions to evaluate and it can return the final value.

If this all sounds correct (and please correct me if I'm wrong) then the tradeoff is some re-run overhead in order to skip having to deal with promises or yield/generators.



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

Search: