- From: Adam Rice <notifications@github.com>
- Date: Wed, 04 Apr 2018 08:24:46 +0000 (UTC)
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/issues/917/378521124@github.com>
It's easy enough for a JS implementation to switch from destructuring to explicitly lookups. Blink's implementation has switched back and forth at various times. So I'm not worried about that. However, for C++ implementations, trying to unpack an options object directly from C++ can be cumbersome and buggy, as Blink's RequestInit constructor demonstrates: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/fetch/RequestInit.cpp?q=RequestInit::RequestInit. If you use WebIDL then you end up with this algorithm: https://heycam.github.io/webidl/#es-dictionary On the positive side, most validation ends up interleaved with lookup this way, which is how I want to do it. On the negative - WebIDL wants us to [convert](https://heycam.github.io/webidl/#dfn-convert-ecmascript-to-idl-value) the arguments in order. This is problematic now that we've split out the digestion of the underlying object into SetUp\*DefaultControllerFromUnderlying\*, which always happens after processing the strategy. - WebIDL wants us to lookup dictionary members in lexicographical order. This is doable but annoying. - The check that highWaterMark is >=0 will happen in a later step from the conversion of highWaterMark to a number, which is really weird from the point of view of our standard text. Having said that, I haven't written a C++ implementation and I don't know how big of a problem this is in practice. @tschneidereit, do you have any input? I'm thinking the solution may be to add a normative note to each constructor saying something like "All these lookups, type conversions, and validations must be performed, but implementations may change the order". -- 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/issues/917#issuecomment-378521124
Received on Wednesday, 4 April 2018 08:25:21 UTC