W3C home > Mailing lists > Public > public-webapi@w3.org > June 2006

Re: Optional method arguments in the DOM

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Thu, 15 Jun 2006 12:08:09 -0500
Message-ID: <449193F9.8070307@mit.edu>
To: Anne van Kesteren <annevk@opera.com>
CC: "Web APIs WG (public)" <public-webapi@w3.org>, DOM mailing list <www-dom@w3.org>

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:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:55 GMT