Closed JLHwung closed 4 years ago
That syntax has been legal since ES2015, and I don't think it makes sense to change it as part of this proposal.
As for constructor, IMO if we throw on static constructor;
I think this should be done as a needs-consensus PR, not this proposal.
I misread the spec: "prototype"
is banned as propName of MethodDefinition in Class: https://tc39.es/ecma262/#sec-class-definitions-static-semantics-early-errors
The proposal throws early error if PropName of FieldDefinition is "prototype" or "constructor".
Should we also throw early error for accessors? i.e.
and
Related
35 mentions
static constructor() {}
is meant to work with https://github.com/erights/Orthogonal-Classes/commit/93bd1c4a19acd3155b62b6f27e94f9ef98a13a11, but should we throw on the following cases?Implementation status as of June 2020
Although current spec have not forbid the cases mentioned above, current implementations banned
prototype
but allowedconstructor
in method definitions.(✔️ for pass and ❌for throwing error)
static get constructor() {}
static set constructor(_) {}
static get prototype() {}
static set prototype(_) {}
static prototype() {}
Given the current implementation status, I think we can at least consider add to the spec
As for
constructor
, IMO if we throw onstatic constructor;
, then we should also disallowstatic get constructor() {}
andstatic set constructor(_) {}