News for hackers. Stuff that matters.
Re:Bluebird in the wild: Advanced promise-based workflows by iheartmemcache on Thursday April 21, 2016 @09:23AM (#11541885)
ECMAscript 6 has cancellable promises? This guy[1] seems to claim otherwise. I spent 20 minutes on skimming the spec[2] and from what I can tell, there's no language feature that has that `promiseCapability'[3] and those stackoverflow workarounds remain the only native ECMAscript way to do it.

(I had to look up what that bluebird was and it looks like they both are libraries that offer cancellable functionality that the callee can invoke. So it looks like one is left to libraries regardless of Bluebird or RxJS or another solution. I'd opt for RxJS personally as RxJS is fairly first-class in the MS ecosystem (maybe one half-step beneath F#), and a lot of the product is based off of the RX research done by de Smet, Meijers, Beckman, et al (they've thrown prime engineering talent at it for years working out the concurrency semantics). But again, not in the JS ecosystem and just skimmed the standard[4] revision so there's a very high chance of me being wrong. I try to limit my comments to topics on which I'm relatively well-informed in general; in this case, please do regard my comments as poorly-informed-at-best.)

[1] http://stackoverflow.com/a/30235261 [2] https://tc39.github.io/ecma262/ [3] https://tc39.github.io/ecma262/#sec-promise-executor [4] Oh god, 25.4.4.1.1 - Runtime Semantics: PerformPromiseAll( iteratorRecord, constructor, resultCapability ). And I thought 'Rails magic' was bad. Step 6 goes all the way down from [a..r] haha.

Re:Bluebird in the wild: Advanced promise-based workflows by inglor on Saturday April 23, 2016 @09:43AM (#11555493)
ECMAScript doesn't have cancellable promises, but then again it doesn't have observables or async iterators either.

Native observables are less capable in this regard than native promises since they're non existent yet.

Bluebird promises are cancellable.

For what it's worth I've discussed this personally with Meijer (it's Meijer, not Meijers) and he agrees that cancellable promises are not problematic one bit.

Promises, observables and other async primitives all co-exist just fine :)