- From: Kyle Simpson <notifications@github.com>
- Date: Fri, 27 Mar 2015 08:43:39 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Message-ID: <whatwg/fetch/issues/27/86980089@github.com>
@jakearchibald
Before I get to the other points you've brought up (I have responses), let me focus on and clarify just this one:
> signal disinterest in the result, and let a promise react to all observers becoming disinterested.
Let me try to illustrate my question/concern (and perhaps misunderstanding). Assume:
```js
var parent = new Promise(function(resolve){ setTimeout(resolve,100); }),
child1 = parent.then(function(){ console.log("child1"); }),
child2 = parent.then(function(){ console.log("child2"); });
```
First, what happens here?
```js
parent.cancel();
```
Do both `"child1"` and `"child2"` still get printed? Or neither?
----
If merely passing `parent` around to various different parts of a system that separately want to observe it means that any one observer (the code that creates `child1`, for example) can unilaterally decide that another part of the system (the code that creates `child2`) is prevented from knowing about what happens with `parent` -- and thus just hangs around waiting in vein -- that's "action at a distance" and is a software design practice that's usually frowned upon. It makes systems harder to reason about and trust. I can follow up with illustrating a `fetch(..)` specific scenario I have in mind, if necessary.
----
Now, what happens if instead:
```js
child1.cancel();
```
Does that mean that `"child2"` does or does not get printed? Same concerns as above.
---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/27#issuecomment-86980089
Received on Friday, 27 March 2015 15:44:10 UTC