W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2009

Re: WebIDL extension proposal for [Enumerable] interface attribute

From: Anselm R Garbe <anselm@aplixcorp.com>
Date: Tue, 14 Jul 2009 10:29:17 +0100
Message-ID: <89d1e7b80907140229o12073ac2pa80cff683792937c@mail.gmail.com>
To: public-webapps@w3.org
Hi Cameron,

2009/7/13 Cameron McCormack <cam@mcc.id.au>:
> 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;
>  };
>
> where:
>
>  * Dictionary interfaces cannot declare any constants or operations.
>
>  * Dictionary interfaces can inherit only from other dictionary
>    interfaces.
>
>  * 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
>    interface.
>
>  * 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.

Yes, I'm happy with this proposal, it would provide good syntactical
support for declaring such dictionary interfaces.

Kind regards,
Anselm
Received on Tuesday, 14 July 2009 09:29:59 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:32 GMT