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

Make null an explicit type (remove nullable types) #866

Closed
annevk opened this issue Mar 27, 2020 · 3 comments
Closed

Make null an explicit type (remove nullable types) #866

annevk opened this issue Mar 27, 2020 · 3 comments

Comments

@annevk
Copy link
Member

annevk commented Mar 27, 2020

In #827 the idea came up that now that we have unions we could handle null in a generalized way. That is, rather than DOMString?, you would write (DOMString or null).

I like that this adds a lot of clarity with regards to the allowed values, but I do worry a bit about the verbosity. We might want to add a typedef for NullableDOMString or some such.

@domenic
Copy link
Member

domenic commented Mar 27, 2020

I prefer having a shorthand. This is so common, both on the web platform and in programming languages in general, that removing the shorthand is not helpful.

We could define the shorthand as being equivalent to such a union, but even then, I'd prefer we advise people to never explicitly use the union, for consistency.

@annevk
Copy link
Member Author

annevk commented Mar 27, 2020

I guess in that case you'd also be in favor of continuing to ignore null for various extended attributes as a special case? Let's close this then.

@domenic
Copy link
Member

domenic commented Mar 27, 2020

Right, although I'd phrase it as an operator precedence issue: [AllowShared] ArrayBuffer? is interpreted as ([AllowShared] ArrayBuffer)?, not [AllowShared] (ArrayBuffer?).

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

2 participants