[whatwg/webidl] Normative source of truth for extended attribute applicability and constraints (#1045)

Spun off from prior convo (https://github.com/whatwg/webidl/pull/940#issuecomment-943924610).

Currently, the rules for which constructs extended attributes are applicable to and secondary constraints (e.g. when two EAs are mutually exclusive) end up specified in multiple places without one location clearly acting as normative/authoritative. Sometimes these do not seem to be in agreement.

For example, the section defining [Unscopable] begins "If the [Unscopable] extended attribute appears on a regular attribute or regular operation," but the lists of which EAs are applicable to regular attributes and regular operations (in their respective sections) do not list [Unscopable].

It might be better if the EA definitions alone provide specify applicability. One reason to favor this as source-of-truth is that applicability conditions are often more complex than just the kind of construct (e.g. [PutForwards] is applicable to only readonly attributes that are not namespace members) and the per-construct lists don't capture the full picture (and might be misleading).

In the mutual exclusion cases, usually each EA's section lists all of the other EAs which it may not appear with, but these lists are also not always consistent. For example:

- the [LegacyWindowAlias] section specifies that it is mutually exclusive with [LegacyNoInterfaceObject] and [LegacyNamespace]
- the [LegacyNamespace] section specifies that it is mutually exclusive with [LegacyNoInterfaceObject] only
- the [LegacyNoInterfaceObject] section mentions neither requirement

These cases are less simple to solve because no single EA in question is the naturally authoritative place for the mutual exclusion to be described. One idea might be a single table that specifies which EAs are compatible with each other explicitly. I suspect that there are some mutual exclusion constraints which _should_ exist that are currently not specified at all and this might help to reveal them. For example, I would guess that [Global] and [LegacyNamespace] should be considered mutually exclusive.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/1045

Received on Friday, 15 October 2021 07:10:48 UTC