- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Sun, 27 Jul 2014 12:26:29 -0700
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: Simon Pieters <simonp@opera.com>, www-style list <www-style@w3.org>, Cameron McCormack <cam@mcc.id.au>
On Sun, Jul 27, 2014 at 5:58 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote: > On 7/27/14, 2:25 AM, Tab Atkins Jr. wrote: >> It's still possible to do, of course, if we're willing to abandon >> WebIDL handling and just use an "any" type that is introspected in >> prose. > > 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... Requiring dictionaries to be optional makes sense in every case *except for* this handful of stupid legacy behaviors, so it's probably not worth it to make that valid, especially since we have an algorithm to invoke to easily convert it. Obviously this should be accompanied by a comment in the IDL talking about what it actually means to express, but I think it's otherwise fine. > 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. Yeah, I don't think having "top" set to the wrong initial value is worth it. We should just do (boolean or object). ~TJ
Received on Sunday, 27 July 2014 19:27:15 UTC