Re: [fetch] Aborting a fetch (#27)

@jakearchibald - I think this conflates the owner of the chain with a consumer of the chain. Literally, even: `p` looks like it's being assigned an entire chain, so it must be its owner, right?

Unfortunately, that semantic is lost on the language, so when we break it down:

    var p1 = fetch(url);
    var p2 = p1.then(r => r.json());
    p2.cancel();

It becomes much less obvious to me that `pc2.cancel()` should cancel the fetch, as control would be swimming upstream. `throw` doesn't even have this power. While it might be effective, it's unintuitive, and not without surprises:

##### Surprise 1:
Control is foiled at the first junction point it finds upstream. There are none in this example, but as I showed 27 days ago, in general you have no way of knowing all junction points - *and they should not even concern you* - which can lead to unintended consequences and hard-to-find bugs ("action at a distance").

##### Surprise 2:
Today, promises can be shared with and distributed to other code without giving up control. Changing this would be a surprise, and make it harder to reason about who has control.

Worse, it can lead to fear of sharing promises with other code, because control is now implicitly shared where before it wasn't, affecting how people design.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/27#issuecomment-111167400

Received on Thursday, 11 June 2015 15:08:14 UTC