[heycam/webidl] Adding slots [initial braindump] (#258)

I'd like to tackle adding slots to WebIDL soonish.

After some preliminary discussions in #whatwg on irc, it seems we want to start with a lightweight system and see how that goes first.

### What values can slots contain?

It seems slots should be able to indifferently hold WebIDL types, Infra [primitive data types](https://infra.spec.whatwg.org/#primitive-data-types) and [data structures](https://infra.spec.whatwg.org/#data-structures), and flags (boolean thingies that are either set or unset).


### Type coercion

We want to avoid type coercion. Editors need to be explicit about what values slots hold and make sure not to rely on type coercion for those.

Should we disallow type unions in slots?


### Syntax for defining slots

Should we define slots in WebIDL fragments? e.g.:

```webidl
interface Animal {
  slot children;
  readonly attribute DOMString name;
  attribute unsigned short age;
};
```

If so, what syntax should we use?

Should we include slot type in there? If so, how do we handle infra "types"?

How do we deal with inheritance?

Should we instead consider using tables for slots like the [Streams spec does](https://streams.spec.whatwg.org/#default-reader-internal-slots)?


### Syntax for using slots

We'd want to be able to use slots in specs like we use ES6 ones:

```
1.  If object.[[flag]] is unset, then:
    1.  Set object.[[state]] to "errored",
    1.  Etc.
```

### Bindings

Slots are private so no bindings. Is that worth being explicit about?

### Other

This is the first time I tackle adding a large feature to WebIDL, so I'm pretty sure I haven't considered all the things. Comments, thoughts, questions, etc. are most welcome.


-- 
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/issues/258

Received on Sunday, 18 December 2016 16:19:22 UTC