W3C home > Mailing lists > Public > public-html@w3.org > November 2008

Re: [WebIDL] Treatment of getters and setters

From: Cameron McCormack <cam@mcc.id.au>
Date: Mon, 17 Nov 2008 20:24:03 +1100
To: public-webapps@w3.org, public-html@w3.org
Message-ID: <20081117092403.GB30452@arc.mcc.id.au>

Hi Jonas.

Jonas Sicking:
> It seems very unfortunate that we now have to use prose to describe  
> which functions the getters/setters map to. Why was that part of these  
> changes needed?

Basically because these are no longer handled by being returned by a
custom [[Get]] method on host objects, and now are described as causing
properties to be created/modified/deleted on the host object.  My
reasoning was that if Web IDL depended on an operation returning null to
indicate that there’s no such element in the collection, it breaks the
encapsulation between Web IDL and the spec using it, somewhat.

*thinks a bit*

So, we probably need to keep requiring the spec using [NamedIndex] to
specify in prose what the keys are.  That should be sufficient to
nominate operations to be the property creator/modifier/deleter
handlers.  For example, something like:

  [NumberedIndex, NamedIndex]
  interface A {
    [NumberedIndexGetter] Element item(in unsigned long index);
    [NamedIndexGetter] Element namedItem(in DOMString name);

  The numbered index has keys in the range 0 ≤ index < length.
  The named index has a key for every string that when passed to
  namedItem() would return a node.

Then the operations could still handle that common case of being the
setter/getter methods.

How does that sound?

Cameron McCormack ≝ http://mcc.id.au/
Received on Monday, 17 November 2008 09:25:01 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:44:39 UTC