tc39 / proposal-grouped-and-auto-accessors

Grouped Accessors and Auto-Accessors for ECMAScript
https://tc39.es/proposal-grouped-and-auto-accessors
MIT License
54 stars 5 forks source link

Should we allow grouped get + #set collide with same name public setter? #8

Closed JLHwung closed 2 years ago

JLHwung commented 3 years ago

We may choose to make it an early error to have both a grouped set and a grouped #set for the same name on the same class.

How should we handle the following grouped #set + ungrouped set cases?

class C {
  accessor a { get; #set }
  set a(value) {}
}

If we decide to throw for grouped cases, then I think we should throw for the ungrouped example above, too.

Of course if people are not using grouped/auto accessors at all, e.g.

class C {
  get a() {}
  set #a(value) {}
  set a(value) {}
}

it should be completely fine per current spec.

rbuckton commented 2 years ago

For now I've decided to align with existing spec behavior if you have colliding declarations (i.e., they would merge at the end). However, I do restrict what's permitted inside of an AccessorGroup, so you cannot have accessor x { get; set; #set; }.