Re: [WebIDL] Treatment of getters and setters

Cameron McCormack:
> 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.
…
> Then the operations could still handle that common case of being the
> setter/getter methods.
> 
> How does that sound?

So I’ve done something similar to this, but reverting to the extended
attribute names that were used before.  There is now the option to place
[IndexGetter], [IndexSetter], [NameGetter], [NameSetter] (as well as the
new ones [IndexCreator], [IndexDeleter], [NameCreator] and
[NameDeleter]) on the interface itself, to allow their behaviour to be
specified in prose, or on an operation, in which case the behaviour is
taken from the behaviour specified for the operation.

A small amount of prose is still required to state what the valid
indices or names are for a given object.

I’ve reinstated the definition of [[Put]] for host objects to handle
[IndexSetter], [IndexCreator], [NameSetter] and [NameCreator].  I’ve
also added a definition for [[Delete]] for host objects to handle
[IndexDeleter] and [NameDeleter].

See:

  http://dev.w3.org/2006/webapi/WebIDL/#indexed-property-xattrs
  http://dev.w3.org/2006/webapi/WebIDL/#named-property-xattrs
  http://dev.w3.org/2006/webapi/WebIDL/#indexed-and-named-properties
  http://dev.w3.org/2006/webapi/WebIDL/#put
  http://dev.w3.org/2006/webapi/WebIDL/#delete

The terminology in places still isn’t the best — for example it’s
confusing having “named properties” be the abstract properties
associated with an object that can have getter/setters, while calling
the ECMAScript properties that appear on the host object “corresponding
named properties”.  But that can be fixed later.

So for HTMLCollection as it currently stands in the spec, all that would
need to be added is something like the following:

  Objects implementing HTMLCollection have indexed properties with indices
  in the range 0 ≤ key < length.  Such objects also have named properties
  for every name that, if passed to namedItem(), would return a node.

Thanks,

Cameron

-- 
Cameron McCormack ≝ http://mcc.id.au/

Received on Tuesday, 18 November 2008 10:45:30 UTC