Re: [heycam/webidl] [wip] First pass at adding internal slots (#495)

I don't think the percentage of slot-backed attribute is as high as 95+%. Especially if you take into account special setter logic that isn't just "set to the value", but also performs some state-checking or validation.

That said, it's probably over 50%. (We'd need to do a survey to be sure.)

My preferred way of threading this needle would be that slots should be explicit, but it should be easy to auto-generate getters (and optionally setters) from the slots. For example

```
interface CustomEvent {
  [[detail]];
  get detail <- [[detail]];

  // or (no separate slot declaration):

  any [[detail]] -> get detail;

  // or, using existing attribute syntax:
  [[detail]];
  readonly attribute any detail <- [[detail]];

  // or (no separate slot declaration):
  readonly attribute any detail <-> [[detail]];
}
```

My general feeling is also opposite @annevk's; I don't think there's any value in creating yet another convention for private state, and hoping people use it, without adding some code/spec-generation benefits at the same time, of the sort listed in his bullet points. Just relocating the same information from `<dl>`s or `<table>`s into IDL blocks does not seem worthwhile, and in fact seems like a bit of a layering violation, in that currently IDL only defines observable public facets of a class.

-- 
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/495#issuecomment-446770997

Received on Wednesday, 12 December 2018 22:38:54 UTC