- From: Kyle Simpson <notifications@github.com>
- Date: Fri, 27 Mar 2015 11:24:09 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Message-ID: <whatwg/fetch/issues/27/87042436@github.com>
@jakearchibald > that's bad form of the child1 code The concern is not about what the "child1 code" *should* do, it's about what the "child1 code" *can* do. As promises stand now, "child1 code" cannot affect "child2 code". That's by design, and it's a good thing. > they can cast to `Promise` I had a feeling this suggestion was coming soon. So, you're essentially saying: ```js var p = fetch(..), p_safe = Promise.resolve(p); // later child1 = p_safe.then(..) .. ``` Sure, that might work to isolate the capability, since `p_safe` wouldn't have a `cancel(..)`. But then, that two-step you've shown is essentially the same in spirit as: ```js var controller = fetch(..), p = controller.promise; // later child1 = p.then(..) ``` The problem with having "controller" be a `CancelablePromise` and expecting people to understand this nuance and pre-cast with `Promise.resolve(..)` is that most won't understand, and will just pass the cancelable-promise around, until they get bitten, and it won't be entirely clear why. I'd call that pit-of-failure design. --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/27#issuecomment-87042436
Received on Friday, 27 March 2015 18:24:31 UTC