domenic at domenicdenicola.com (2013-11-29T17:30:54.212Z)
Benjamin (Inglor) Gruenbaum wrote:
> I was refering to my original post in this thread about try/catch with
> generators:
> http://esdiscuss.org/topic/try-catch-conditional-exceptions-in-light-of-generators#content-0
Yes, but the Domenic pointed out that the reference error there has
nothing to do with generators so much as async control flow in general
(it could be in a function passed as a callback or downward funarg, and
called "later" by any means). And you seemed to agreed.
It's true that yield allows part of a function to run in a later event
loop turn -- or just in a later iteration of a loop in the same turn.
Generators by themselves are not async in the event loop sense. So first
you need to identify the problem precisely.
If you write
function f() { ... setCallback(function g() {... RefErrHere ... }) ... }
you need test coverage over the body of g.
If you write
function* f() { ... yield; RefErrHere ... }
same deal. There is no difference in kind.
So, is the problem you are citing a general one of test coverage over
async control flow?
Benjamin (Inglor) Gruenbaum wrote: > Hi, thanks for the comment and sorry for the unclarity. > > I was refering to my original post in this thread about try/catch with > generators: > http://esdiscuss.org/topic/try-catch-conditional-exceptions-in-light-of-generators#content-0 Yes, but the Domenic pointed out that the reference error there has nothing to do with generators so much as async control flow in general (it could be in a function passed as a callback or downward funarg, and called "later" by any means). And you seemed to agreed. It's true that yield allows part of a function to run in a later event loop turn -- or just in a later iteration of a loop in the same turn. Generators by themselves are not async in the event loop sense. So first you need to identify the problem precisely. If you write function f() { ... setCallback(function g() {... RefErrHere ... }) ... } you need test coverage over the body of g. If you write function* f() { ... yield; RefErrHere ... } same deal. There is no difference in kind. So, is the problem you are citing a general one of test coverage over async control flow? /be