W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2009

Re: Handling too few arguments in method calls

From: Cameron McCormack <cam@mcc.id.au>
Date: Thu, 25 Jun 2009 17:27:28 +1000
To: Simon Pieters <simonp@opera.com>
Cc: public-webapps@w3.org
Message-ID: <20090625072728.GI4736@arc.mcc.id.au>
Cameron McCormack:
> > From some very brief testing, it seems that Firefox and Opera tend
> > to throw an exception when calling a method with too few arguments,
> > while IE, Safari and Chrome will assume that the missing arguments
> > were the undefined value.

Simon Pieters:
> Hmm. What did you use as test case?

I did calls like:


making sure I could distinguish between that behviour and the behaviour
I’d get if calling with (undefined).

> I think I prefer option 2. It's easier for authors to find their mistake. 
> If a spec author wants the behavior of option 1, then that's possible 
> with [Optional].

I tend to prefer option 2, as well, for those reasons, plus it might
help us if we introduce new overloadeded operations later.  For example,
if we had

  interface A {
    /* f1 */ void f();
    /* f2 */ void f(in boolean x, in boolean y, in boolean z);

and authors were calling A.f(something) and getting f2, then it might
make it harder for us to introduce

  void f(in boolean w);

or even

  void f(in DOMString w);

later on.

Cameron McCormack ≝ http://mcc.id.au/
Received on Thursday, 25 June 2009 07:28:23 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:16 UTC