Skip to content

Normative source of truth for extended attribute applicability and constraints #1045

Open
@bathos

Description

@bathos

Spun off from prior convo (#940 (comment)).

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 were to 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 which 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 up front before the specific EA subsections. Flipping to explicitly saying which are compatible instead of incompatible might help avoid accidentally incoherent changes. 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, but currently they are not specified this way.

One more example of the kind of hard-to-spot stuff that happens with the current model: presently, the operation of a callback interface can take [LegacyUnforgeable], among others, if the spec is read literally, but this pretty clearly doesn't make sense and no behavior is specified that would be compatible with it.

(@annevk)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions