Re: WebIDL extension proposal for [Enumerable] interface attribute

Cameron McCormack:
> > Do you need to specify that some of the optional attributes are
> > enumerable while others aren’t?  Or should all of the optional
> > attributes be enumerable?

Anselm R Garbe:
> We only need to specify that all (optional) attributes are enumerable,
> so basically that means we need something that says "all attributes of
> this interface are enumerable, including the optional ones".

How about syntax like the following:

  dictionary interface GenericDictionary {

  dictionary interface FileMetadata {
    readonly attribute long size;
    readonly attribute Date creation;
    readonly attribute Date modification;

  dictionary interface ExtendedFileMetadata : FileMetadata {
    attribute boolean readable;
    attribute boolean writable;
    attribute boolean executable;


  * Dictionary interfaces cannot declare any constants or operations.

  * Dictionary interfaces can inherit only from other dictionary

  * In ES, there are no interface prototype objects for dictionary
    interfaces and thus don’t affect the prototype chain.

  * Attributes are always effectively optional.

  * Attributes are exposed as properties on the host object, just like
    with regular interfaces.

  * Entries in a dictionary interface that don’t correspond to the
    attributes declared on them are also exposed as properties on the
    host object in ES, and are enumerable (unlike corresponding named
    properties for regular interfaces).

  * Dictionary interfaces are implicitly [Callable,NoInterfaceObject].
    [OverrideBuiltins] could be used, which would make dictionary
    lookups take precedence over other property lookups, as with
    regular interfaces with getters.

  * Dictionary keys are always DOMStrings.

  * A “dictionary” (an object that implements one or more dictionary
    interfaces) can be designated as “not extensible”, which means
    effectively the same thing as not having a creator on a regular

  * An entry in a dictionary can be designed as “read only”, which
    means that assigning to it or attempting to remove it will fail
    (ignored in ES, exception thrown in Java).  Explicit attributes are
    designed as read only as with regular interfaces, by using the
    "readonly" keyword.

  * In Java, any dictionary interface would correspond to the
    java.util.Map<String,Object> interface.

Cameron McCormack ≝

Received on Monday, 13 July 2009 01:29:27 UTC