W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2006

Re: Optional method arguments in the DOM

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Thu, 15 Jun 2006 14:32:43 -0700
Message-ID: <c9e12660606151432l258d9221j7fa702e326853164@mail.gmail.com>
To: "DOM mailing list" <www-dom@w3.org>

I actually like this idea.

For example:
scrollIntoView( [bShowAtTop] )

hypothetical

b.cloneNode() // equivalent to b.cloneNode( false );



On 6/15/06, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>
> 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
>
>


-- 
http://dhtmlkitchen.com/
Received on Thursday, 15 June 2006 21:32:54 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 23:40:09 UTC