Quantcast
Channel: Uncategorized
Viewing all articles
Browse latest Browse all 8

Yield during finally?

$
0
0

Bradley Meck wrote:

I am a bit confused if yield during finally {} is supposed to pause execution of a generator.

In most implementations this works and matches how you can override the CompletionRecord during finally {} by using return/throw.

However there is an issue on v8 : https://code.google.com/p/v8/issues/detail?id=3133

So what should happen in the following code:

function* g() {
  try {
    yield String(111);
  }
  finally {
    yield String(123);
  };
}
let o = g();
console.log('init', o.next());
console.log('preempt ret', o.return());
// v8 issue disagrees, states this should already be done, and cause an error
console.log('after finally yield', o.next());

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images