Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What types are allowed where is scattered and inconsistent #1414

Open
domenic opened this issue Jun 26, 2024 · 0 comments
Open

What types are allowed where is scattered and inconsistent #1414

domenic opened this issue Jun 26, 2024 · 0 comments

Comments

@domenic
Copy link
Member

domenic commented Jun 26, 2024

What is the issue with the Web IDL Standard?

We have various ad-hoc restrictions on different constructs, mostly types and extended attributes, being allowed or disallowed in various places. For example:

  • Observable array types are only allowed on regular attributes on interfaces
  • After Disallow non-attribute frozen arrays #1413, frozen array types are only allowed on regular or static attributes on interfaces
  • The any type must not be used as a union member type
  • Nullable types' inner types must not be from a certain list
  • undefined must not be used as an argument type
  • sequence types must not be used as attribute or constant types

These restrictions appear in different places, sometimes in the place declaring the type, and sometimes in the place declaring the construct that only accepts a restricted set of types. It would be nice if this was more uniform and easy to understand.

My suggestion is that we make a list of all possible places a type can appear (including ones you might not think of like as the inner type of a promise type or record). Then each type can contain a table listing whether it's allowed in such places. Possibly with asterisks in a given cell if necessary to explain some complexity.

I'm unsure then whether we'd want to include "back references". E.g., in the definition of promise types, we say that they're disallowed as the inner type of a nullable type. Then, in the definition of nullable type, do we also list the allowed or disallowed types? Maybe not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant