Re: [WebIDL] Treatment of getters and setters

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:03 UTC