This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 10336 - "optional" should be allowed even if subsequent arguments aren't optional
Summary: "optional" should be allowed even if subsequent arguments aren't optional
Status: RESOLVED WONTFIX
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebIDL (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Cameron McCormack
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-09 22:28 UTC by Ian 'Hixie' Hickson
Modified: 2010-10-28 04:23 UTC (History)
2 users (show)

See Also:


Attachments

Description Ian 'Hixie' Hickson 2010-08-09 22:28:51 UTC
It should be possible to say:

  void drawImage(in HTMLImageElement image, in float dx, in float dy, in optional float dw, in float dh);

...so that it means the same as:

  void drawImage(in HTMLImageElement image, in float dx, in float dy);
  void drawImage(in HTMLImageElement image, in float dx, in float dy, in float dw, in float dh);

Basically, have "optional" means that if the argument is omitted, all subsequent ones must be too, but that if it is included, any subsequent arguments up to the next "optional" must be included.

Currently, "optional" can't be omitted on arguments after the first with "optional", so the above isn't possible.
Comment 1 Cameron McCormack 2010-10-28 04:23:39 UTC
That is in fact what the spec used to allow (with [Optional], a long time ago).  I removed it because I deemed it confusing: it looks like you can omit dw but still specify dh.  The three overloaded operations make it much clearer, IMO.