diff --git a/index.bs b/index.bs index 31c78b05..75bac32a 100644 --- a/index.bs +++ b/index.bs @@ -818,12 +818,25 @@ across [=IDL fragments=].
[extended_attributes] @@ -832,25 +845,126 @@ state and behavior that an object implementing that interface will expose. };-An interface is a specification of a set of -interface members -(matching
+ [extended_attributes] + interface identifier { + [extended_attributes] + const type constant_identifier = 42; + + [extended_attributes] + attribute type identifier; + + [extended_attributes] + return_type identifier(/* arguments... */); + }; ++ + +
interface identifier : identifier_of_inherited_interface { @@ -858,8 +972,6 @@ have members that correspond to the interface members from the inherited interfa };-The order that members appear in has significance for property enumeration in the ECMAScript binding. - Interfaces may specify an interface member that has the same name as one from an inherited interface. Objects that implement the derived interface will expose the member on the derived interface. It is @@ -929,33 +1041,8 @@ interface |B| that inherits from |A|, and so on. 1. Return |result|. -Note that general multiple inheritance of interfaces is not supported, and -objects also cannot implement arbitrary sets of interfaces. -Objects can be defined to implement a single given interface |A|, -which means that it also implements all of |A|’s [=inherited interfaces=]. -In addition, an [=includes statement=] can be used -to define that objects implementing an [=interface=] |A| -will always also include the [=interface mixin member|members=] -of the [=interface mixins=] |A| [=includes=]. - -Each interface member can be preceded by a list of [=extended attributes=] (matching -
- [extended_attributes] - interface identifier { - - [extended_attributes] - const type constant_identifier = 42; - [extended_attributes] - attribute type identifier; - - [extended_attributes] - return_type identifier(/* arguments... */); - }; -+
interface SomeInterface { @@ -990,40 +1075,13 @@ Note: A partial interface definition cannot specify that the interface Inheritance must be specified on the original [=interface=] definition. -The relevant language binding determines how interfaces correspond to constructs -in the language. - -The following extended attributes are applicable to interfaces: -[{{Exposed}}], -[{{Global}}], -[{{LegacyWindowAlias}}], -[{{NamedConstructor}}], -[{{NoInterfaceObject}}], -[{{OverrideBuiltins}}], and -[{{SecureContext}}]. - -The following extended attributes are applicable to [=partial interfaces=]: +The following extended attributes are applicable to [=partial interface=] [=definitions=]: [{{Exposed}}], [{{OverrideBuiltins}}], and [{{SecureContext}}]. -[=Interfaces=] which are not annotated -with a [{{NoInterfaceObject}}] [=extended attribute=] -must be annotated with an [{{Exposed}}] [=extended attribute=]. - -- -The qualified name of an [=interface=] |interface| is defined as follows: - -1. Let |identifier| be the [=identifier=] of |interface|. -1. If |interface| has a [{{LegacyNamespace}}] [=extended attribute=], then: - 1. Let |namespace| be the identifier argument of the [{{LegacyNamespace}}] - [=extended attribute=]. - 1. Return the [=concatenation=] of « |namespace|, |identifier| » with - separator U+002E FULL STOP ("."). -1. Return |identifier|. -+Syntax
CallbackOrInterfaceOrMixin : @@ -1188,11 +1246,16 @@ The qualified name of an [=interface=] |interface| is defined as follInterface mixins
-An interface mixin is a definition (matchinginterface MixinRest ) -that declares state and behavior that can be [=included=] by one or more [=interfaces=], +An interface mixin is an entity that declares state and behavior in the form of +[=interface mixin members=] that can be [=included=] by one or more [=interfaces=], and that are exposed by objects that implement an [=interface=] that [=includes=] the [=interface mixin=]. +An [=interface mixin=] must exist for every [=definition=] matchinginterface +MixinRest in an [=IDL fragment=] supported by the +implementation. +This [=definition=] defines the [=interface mixin's=] [=identifier=]. +interface mixin identifier { /* mixin_members... */ @@ -1207,28 +1270,89 @@ They are not meant to be exposed through language bindings. Guidance on when to choose [=partial interfaces=], [=interface mixins=], or [=partial interface mixins=] can be found in [[#using-mixins-and-partials]]. -An [=interface mixin=] is a specification of a set of interface mixin members -(matchingMixinMembers ), -which are the [=constants=], [=regular operations=], [=regular attributes=], and [=stringifiers=] -that appear between the braces in the [=interface mixin=] declaration. +Note: Unlike [=interfaces=] or [=dictionaries=], [=interface mixins=] do not create types. + +Of the extended attributes defined in this specification, +only the [{{Exposed}}] and [{{SecureContext}}] extended attributes +are applicable to [=interface mixins=]. -These [=constants=], [=regular operations=], [=regular attributes=], and [=stringifiers=] -describe the behaviors that can be implemented by an object, -as if they were specified on the [=interface=] that [=includes=] them. -[=Static attributes=], [=static operations=], [=special operations=] except for [=stringifiers=], and -[=iterable declaration|iterable=], [=asynchronously iterable declaration|asynchronously iterable=], -[=maplike declaration|maplike=], and [=setlike declarations=] cannot appear in [=interface mixin=] -declarations. +Members
+ +An [=interface mixin=] contains a [=list=] of [=interface mixin members=], which define most of its +behavior. These can be declared in the initial interface mixin [=definition=] as well as in a +[=partial interface mixin=] [=definition=]. + ++ +The interface mixin members of an [=interface mixin=] +|M| are given by the following algorithm: + +1. Let |members| be « ». +1. Let |initialDefinition| be the [=definition=] that matches+ +[=Interface mixin members=] have a host interface, which is initially unset. + +Note: The [=host interface=] of an [=interface mixin member=] is used to decide whether the +[=interface mixin member|member=] is [=exposed=]. + +Note: When an [=interface=] |I| [=interface/includes=] an [=interface mixin=] |M|, |I|'s [=list=] +of [=interface members=] has a copy of each of the [=interface mixin member|members=] of |M|, +with their [=host interface=] set to |I|. +In particular, if two [=interfaces=] [=interface/include=] a single [=interface mixin=], each +[=interface=] gets an independent copy of the [=interface mixin members|members=]. + +Note: In ECMAScript, this implies that each [=regular operation=] +declared as a [=interface mixin member|member=] of [=interface mixin=] |M|, +and exposed as a data property with a [=built-in function object=] value, +is a distinct [=built-in function object=] +in each [=interface prototype object=] +whose associated [=interface=] [=includes=] |M|. +Similarly, for [=attributes=], each copy of the accessor property has +distinct [=built-in function objects=] for its getters and setters. + + +interface +MixinRest , and whose [=identifier=] matches + |M|'s. +1. Let |initialMembers| be the [=list=] of [=members=] defined by the +MixinMembers non-terminal in + |initialDefinition|. +1. [=list/Extend=] |members| with |initialMembers|. +1. Let |partialDefinitions| be the unordered [=/set=] of [=definitions=] that match +partial interface +MixinRest . +1. [=set/For each=] |partialDefinition| of |partialDefinitions|: + 1. Let |partialMembers| be the [=list=] of [=members=] defined by the +MixinMembers non-terminal in + |partialDefinition|. + 1. [=list/Extend=] |members| with |partialMembers|. +1. Return |members|. + +Note: The result includes [=constants=], [=regular operations=], [=regular attributes=], and +[=stringifiers=]. +[=Static attributes=], [=static operations=], [=special operations=] except for +[=stringifiers=], and [=iterable declaration|iterable=], +[=asynchronously iterable declaration|asynchronously iterable=], +[=maplike declaration|maplike=], and [=setlike declarations=] cannot be included in the +MixinMembers non-terminal. + +Note: The order that members appear in has significance for property enumeration +in the ECMAScript binding. + +Issue(heycam/webidl#432): The order of the members is yet to be defined precisely. +Partial interface mixins
As with interfaces, the IDL for [=interface mixins=] can be split into multiple parts by using partial interface mixin definitions (matchingpartial interface MixinRest ). The [=identifier=] of a [=partial interface mixin=] [=definition=] must be the same as the [=identifier=] of an [=interface mixin=] [=definition=]. -All of the [=interface mixin member|members=] that appear on each of the [=partial interface mixin=] [=definitions=] -are considered to be [=members=] of the [=interface mixin=] itself, -and—by extension—of the [=interfaces=] that [=include=] the [=interface mixin=]. + +Note: All of the [=interface mixin member|members=] that appear on each of the +[=partial interface mixin=] [=definitions=] are considered to be [=interface mixin member|members=] +of the [=interface mixin=] itself, and—by extension—[=interface members=] of the [=interfaces=] +that [=include=] the [=interface mixin=].interface mixin SomeMixin { @@ -1240,20 +1364,14 @@ and—by extension—of the [=interfaces=] that [=include=] the [=interface mixi };-The order that members appear in has significance for property enumeration -in the ECMAScript binding. -Note that unlike [=interfaces=] or [=dictionaries=], [=interface mixins=] do not create types. - -Of the extended attributes defined in this specification, -only the [{{Exposed}}] and [{{SecureContext}}] extended attributes -are applicable to [=interface mixins=]. +Includes statements
An includes statement is a definition (matchingIncludesStatement ) -used to declare that all objects implementing an [=interface=] |I| +used to declare that the [=interface members|members=] of an [=interface=] |I| (identified by the first [=identifier=]) -must additionally include the [=interface mixin member|members=] of [=interface mixin=] |M| +will additionally include the [=interface mixin member|members=] of [=interface mixin=] |M| (identified by the second identifier). [=Interface=] |I| is said to include [=interface mixin=] |M|. @@ -1265,32 +1383,6 @@ must additionally include the [=interface mixin member|members=] of [=interface The first [=identifier=] must reference a [=interface=] |I|. The second identifier must reference an [=interface mixin=] |M|. -Each [=interface mixin member|member=] of |M| is considered to be -a [=member=] of each [=interface=] |I|, |J|, |K|, … that [=includes=] |M|, -as if a copy of each [=interface mixin member|member=] had been made. -So for a given member m of |M|, -interface |I| is considered to have a [=member=] mI, -interface |J| is considered to have a [=member=] mJ, -interface |K| is considered to have a [=member=] mK, and so on. -The host interfaces of mI, mJ, -and mK, are |I|, |J|, and |K| respectively. - -Note: In ECMAScript, this implies that each [=regular operation=] -declared as a [=interface mixin member|member=] of [=interface mixin=] |M|, -and exposed as a data property with a [=built-in function object=] value, -is a distinct [=built-in function object=] -in each [=interface prototype object=] -whose associated [=interface=] [=includes=] |M|. -Similarly, for [=attributes=], each copy of the accessor property has -distinct [=built-in function objects=] for its getters and setters. - -The order of appearance of [=includes statements=] affects the order in which [=interface mixin=] -are [=included=] by their [=host interface=]. - -Issue: [=interface mixin member|Member=] order isn't clearly specified, -in particular when [=interface mixins=] are defined in separate documents. -It is discussed in issue #432. - No [=extended attributes=] defined in this specification are applicable to [=includes statements=].@@ -1327,6 +1419,8 @@ No [=extended attributes=] defined in this specification are applicable to [=inc+Syntax
+ @@ -1337,6 +1431,8 @@ No [=extended attributes=] defined in this specification are applicable to [=inc + +MixinRest : "mixin" identifier "{" MixinMembers "}" ";"