Re: Optional method arguments in the DOM

Anne van Kesteren wrote:
> What do implementors and authors think of having more optional method 
> arguments in the DOM where that makes sense?

I frankly think it's a bad idea.  For UA-provided objects, it significantly 
increases the implementation complexity.  Since the IDL used can't express 
optional arguments, the UA would need to either ad-hoc define the default values 
for them or have a long hardcoded list of optional things with some sort of 
automated system for checking against that list on method calls...

Even worse, it increases complexity for _anyone_ who wants to implement these 
interfaces.  Right now, if I want to write a JS library that allows authors to, 
say, abstract away XMLHttpRequest differences between UAs, and I want to use DOM 
events to communicate with my callees, I would implement EventTarget and authors 
could just use patterns they already know to set up listeners for events they're 
interested in.  If you start allowing optional args, then I have to deal with 
authors not passing in all the args, which means more code for me.

-Boris

Received on Thursday, 15 June 2006 17:08:34 UTC