W3C home > Mailing lists > Public > public-webrtc@w3.org > October 2012

SomethingEventInit dictionaries

From: Martin Thomson <martin.thomson@gmail.com>
Date: Thu, 18 Oct 2012 17:31:04 -0700
Message-ID: <CABkgnnUDHzSjCV2bQY9a8iCse5z8qGdYMNnx_-PD47-3Xw_1Eg@mail.gmail.com>
To: public-webrtc@w3.org
The draft currently includes an interesting pattern (thanks Yang for
inadvertently reminding me of this) for declaration of Event classes.
It goes like this:

[Constructor(SomethingEventInit data)]
interface SomethingEvent : Event {
    readonly attribute Something attr;
}
dictionary SomethingEventInit {
    Something attr;
}

After having actually implemented most of this stuff, most of the time
it is sufficient (in JavaScript at least) to instantiate Event and
tack the necessary attributes on.  Even in a formal sense, the
SomethingEventInit object has no need to be in the public namespace,
let alone the specification.  I can understand why the internals of
your implementation might use these, but are really just browser
internals.  Applications don't need either definition.  Why isn't the
pattern like so?

[NoInterfaceObject]
interface SomethingEvent : Event {
    readonly attribute Something attr;
}

It would be a lot clearer that way.  You also don't have to worry
about putting the RTC prefix on these either, since the name is only a
specification convenience.
Received on Friday, 19 October 2012 00:31:32 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:30 UTC