webidl icon indicating copy to clipboard operation
webidl copied to clipboard

ObservableArray is in DistinguishableType production but is not in distinguishable table

Open saschanaz opened this issue 3 years ago • 4 comments

  • https://heycam.github.io/webidl/#prod-DistinguishableType

    DistinguishableType ::
        PrimitiveType Null
        StringType Null
        identifier Null
        sequence < TypeWithExtendedAttributes > Null
        object Null
        symbol Null
        BufferRelatedType Null
        FrozenArray < TypeWithExtendedAttributes > Null
        ObservableArray < TypeWithExtendedAttributes > Null
        RecordType Null
    
  • https://heycam.github.io/webidl/#dfn-distinguishable

If it's intentionally not distinguishable, I think it shouldn't be in DistinguishableType.

saschanaz avatar Jul 21 '21 18:07 saschanaz

And per https://webidl.spec.whatwg.org/#idl-observable-array

Observable array types must only be used as the type of regular attributes defined on an interface

so it is disallowed to be an inner type of sequence, record, FrozenArray, and Promise.

If we could make ObservableArray not a DistinguishableType, but maybe a separate type just for regular attributes, we could handle the restriction in grammar level, which could make the parser implementation a bit simpler.

EdgarChen avatar Oct 18 '21 19:10 EdgarChen

cc @domenic

annevk avatar Oct 19 '21 12:10 annevk

I suspect people more grammar-comfortable, like @saschanaz or @EdgarChen, are better positioned to make this change than me. Would either of you be up for it? Happy to help review...

domenic avatar Oct 19 '21 20:10 domenic

Maybe include it in SingleType instead? That will disallow it being in unions and I think it's expected.

saschanaz avatar Oct 19 '21 21:10 saschanaz