W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2011

[Bug 12248] Make objects first-class API citizens

From: <bugzilla@jessica.w3.org>
Date: Thu, 26 May 2011 21:57:17 +0000
To: public-script-coord@w3.org
Message-Id: <E1QPiYP-00021S-QX@jessica.w3.org>

--- Comment #40 from Cameron McCormack <cam@mcc.id.au> 2011-05-26 21:57:14 UTC ---
I think there would be times when you want to know if a dictionary member
wasn't specified, and where the behaviour of your operation isn't just as if a
particular default value was assumed for that missing member.  For example:

  dictionary ImageDrawingOptions {
    unsigned long width;
    unsigned long height;

  interface Whatever {
    void drawImage(in Image aImage, in optional ImageDrawingOptions options);

Maybe you want to make it so that a call `whatever.drawImage(a, { width: 100
})` results in the height of the drawn image be determined by its aspect ratio.
 You wouldn't be able to use a default value in the IDL there, and you need
drawImage to be able to distinguish between present and not.  Unless you wanted
to say

  dictionary ImageDrawingOptions {
    unsigned long? width = null;
    unsigned long? height = null;

and then define that null means the same thing as the dictionary member not
being present, but that seems less clean to me.

Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Thursday, 26 May 2011 21:57:19 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:03 UTC