Re: [whatwg/streams] Invoking methods should not call .apply() (#613)

I'm not opposed to this if these tests are helpful for implementers, such as yourself.

However, I've been resistant in the past because where do we stop? For example, this is robust against passing in an `{ apply() { } }` object. But it's not robust against overriding `Function.prototype.apply`. Should we be guarding against that? Similarly, we operate on promises a lot by using the built-in `Promise.resolve` and friends, which is not robust against overrides.

In general this kind of comes down to what the role of tests and the reference implementation are. I'm of the opinion the reference implementation is not meant to be perfect in every way; otherwise it would become much less easy to read and develop. Instead it's meant to provide something useful we can write tests against.

Similarly, the goals of tests is not to necessarily hit every possible way something could be implemented wrong; they kind of assume a base level of things being done correctly, in many cases, and focus on testing the important logic.

But, again, any philosophical considerations here are entirely overridden by what works best for implementers. If these sorts of tests are useful, then we should include them. And that means updating the reference implementation to pass them. So if this is useful to you, I'm happy to see this merged in.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/613#issuecomment-260846825

Received on Wednesday, 16 November 2016 03:51:56 UTC