Re: [ServiceWorker] Can we change the body attribute of Request/Response to a method? (#606)

I don't think the design of streams will change that much here. Just like promises, creating the stream implies starting the underlying operation. We could try to re-design streams to no longer be a promise-like primitive representing flowing data, but instead be abstract "handles". But I think the latter is best represented by objects like `Request`.

I think at this point we are just debating whether `body` should be a method or a getter. Again I think it is fine to be a getter since from a developer point of view it doesn't have any side effects, and it is implementation-dependent whether it will have any side effects anyway. That is:

> We want to be able to have the browser refrain from populating the ReadableStream until we say "Go" for that.

That is an implementation perspective. From a developer perspective, it is equally valid to look at the public API and say "`req.body` was already being populated!" They can't tell the difference.

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/606#issuecomment-71041255

Received on Thursday, 22 January 2015 15:49:30 UTC