On Oct 19, 2011, at 2:34 PM, Brendan Eich wrote:
> The other objection is that (ignoring some evil native APIs such as sync XHR)
> JS has run-to-completion execution model now. You can model
>
> assert_invariants();
> f();
> assert_invariants_not_affected_by_f_etc();
Contrast with generators, where you opt-in frame-by-frame:
assert_invariants();
yield f();
yay_i_lost_my_invariants_on_purpose();
This requires trampolining, a scheduler. Delegated yield (yield*, "yield from"
in PEP 380) helps. No free lunch. But you don't lose invariants due to some
callee-of-a-callee suspending, as you would with coroutines.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss