How to terminate a continuation early and call `finally` blocks?

Михаил Кузьмин m.kuzmin at darkleaf.ru
Tue Sep 8 12:33:43 UTC 2020


JS generators have the `return` method:

```javascript
var fn_gen = function* () { 
  try {
    yield
  }
  finally {
    console.log("finally")
  }
};

var gen = fn_gen();
gen.next()
// => {value: undefined, done: false}
gen.return()
// => finally  <= the finally block has been executed 
// => {value: undefined, done: true}
```

Will it be possible with Loom's continuations?



More information about the loom-dev mailing list