tc39 / proposal-class-public-fields

Stage 2 proposal for public class fields in ECMAScript
https://tc39.github.io/proposal-class-public-fields/
488 stars 25 forks source link

ensure duplicate names are handled properly #9

Closed michaelficarra closed 8 years ago

michaelficarra commented 9 years ago
class A {
  b = f();
  b = g();
}

This needs to not error defining b on instances of A twice, and needs to evaluate f() and g() each time A is constructed. The value of fresh instances of A should be the return value of g().

jeffmo commented 8 years ago

Currently, with configurable: false, duplicate properties will error at runtime unless the values are the ===.

configurability is still a topic of debate, but I believe this issue was opened to address an issue with the original design where we could queue a set of instructions to be executed at instantiation time -- where the set was keyed by the property name (i.e. eliminating the execution of f() from ever happening).

This is no longer the case since we no longer store the initialization instructions by the property name