- From: Cameron McCormack <cam@mcc.id.au>
- Date: Mon, 28 Jul 2014 14:18:49 +1000
- To: Boris Zbarsky <bzbarsky@MIT.EDU>
- CC: "Tab Atkins Jr." <jackalmage@gmail.com>, Simon Pieters <simonp@opera.com>, www-style list <www-style@w3.org>
Boris Zbarsky wrote: > You don't actually have to use "any". It would be enough to do: > > void scrollIntoView(); > void scrollIntoView((boolean or object) arg); > > and then manually convert the object to the ScrollOptions dictionary in > prose. That's one extra line of prose, basically. > > In fact, if we didn't have this thing with dictionary types being > required to be optional, we could write this as: > > void scrollIntoView(); > void scrollIntoView((boolean or ScrollOptions) arg); > > I wonder whether it makes sense to change WebIDL to allow that somehow... > > The main difference from the "object" case is that in this case you'd > have to have the default value of "top" in the dictionary be false (so > that explicitly passing null or undefined ends up picking up the "false" > value) while if we did the "boolean or object" thing null/undefined > would get converted to the boolean so you could default the dictionary > member to whatever you want. I agree with Tab; so long as we keep thinking the dictionary-arguments-must-be-optional requirement is a good idea to encourage API design we want, then it'd better to handle this legacy API in prose rather than loosen the requirement.
Received on Monday, 28 July 2014 04:19:28 UTC