Re: [heycam/webidl] Need pattern for feature detecting dictionary members (#107)

> If we're going with this approach, I don't see why we would bother tying it to the dictionary at all, or restricting it to dictionary-taking methods.

Well, part of the idea of this thread is to have it be an easy drop-in for the spec and for implementations so that you can code-generate the method. Indeed the original idea was to auto-generate this for all dictionaries (and enums?) on the platform. My version requires some opt-in per dictionary/dictionary-accepting method, but still code-generates the supports() logic at least.

You seem to be suggesting something that requires more work for spec authors, which is OK. However it also has the downside of possibly being more inconsistent. E.g. it seems like your version of web share doesn't say yes to `supports("url")`, which seems bad. In other words it sounds like `supports("x")` will only return true for `"x"`s added to the spec after some point in time at which the spec authors started caring about feature detection. I think that is not great, compared to automatically synchronizing it with all the keys of a dictionary.

> @RByers suggestion works for me also: this generalizes to "the supports method takes exactly the same arguments as the base method, has no side-effect, and returns true if it notionally would accept that argument".

Ah, that helps me understand it better. In particular you could just pass the blob you're planning to pass to `share()` anyway.

The biggest issue I see is the one you point out about partial support. In particular I can imagine unfortunate coding patterns which end up attempting all combinations of arguments to find the one that has the maximal amount of features the developer wants to use, but still returns true.

The other issue is "no side effects". Web IDL type coercions will cause side effects; indeed you'll perform any type coercions twice. But in most cases, e.g. those not involving getters, that's idempotent...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/107#issuecomment-303920204

Received on Thursday, 25 May 2017 04:37:31 UTC