[heycam/webidl] Allow extended attributes to apply to types (#286)

This implements the plan discussed in https://lists.w3.org/Archives/Public/public-script-coord/2017JanMar/0003.html and sets the stage for using extended attributes for SharedArrayBuffer-related purposes.

@bzbarsky, I could use some close review on this. Some points for discussion:

- Is `[Clamp] long` being a distinct type from `long` a good way of doing this? I based that on how `long?` is different from `long`, and it seems like a good mental model.
- Is it sufficiently clear that extended attributes propagate through typedefs? (A point you called out specifically in your email.) If not, any suggestions on how to make this clear?
- We have separate TypeWithAttributes and Type mainly so that ReturnType does not get attributes. Does that seem good?
- I didn't allow (gramatically) specifying an extended attribute over an entire union. I forget why, but an hour ago it seemed like a bad idea... if you have any thoughts to help guide me one way or another on this that would be appreciated.
- This will invalidate a lot of existing IDL which will need to get updated. E.g. `[TreatNullAs=EmptyString] attribute DOMString data;` must become `attribute [TreatNullAs=EmptyString] DOMString data;`. I think this is the right way to go, as it's clearer how things work and doesn't require any propagation of extended attributes from attribute/argument declarations into their types, which sounds annoying to spec and would cause inconsistency as sometimes people would do that and sometimes not. I also think this would be a good test case for future more-disruptive changes.
- TreatNullAs questions:
  - [Searching Chromium](https://cs.chromium.org/search/?q=TreatNullAs%3DEmptyString+file:.idl&sq=package:chromium&type=cs) I find no instances of this being used on callback interfaces. Can we nuke that part of the spec?
  - While we're here, since this is going to invalidate existing IDL anyway, can we just get rid of the silly identifier argument and make this `[TreatNullAsEmptyString]`?

I hope I didn't miss anything major; this seemed almost too easy...
You can view, comment on, or merge this pull request online at:

  https://github.com/heycam/webidl/pull/286

-- Commit Summary --

  * Allow extended attributes to apply to types

-- File Changes --

    M index.bs (165)
    M index.html (967)

-- Patch Links --

https://github.com/heycam/webidl/pull/286.patch
https://github.com/heycam/webidl/pull/286.diff

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

Received on Wednesday, 25 January 2017 23:06:52 UTC