Split out of #75 (comment)
Reasons to special-case:
- You pretty much never want symbols there, so
requires constructor implements protocol { ... } is a footgun.
- Without the special-casing
requires constructor creates a protocol.constructor symbol, but in Protocol instances, protocol.constructor should point to Protocol. And while protocol.prototype would be blank, it does break assumptions about what obj.prototype is, and prevents us from using protocol.prototype for inheritance.
- Defining class statics is a common enough use case that it originally had dedicated syntax
Reasons to not special-case:
- Slight increase in mental model / handling complexity
I’m personally moderately strongly in favor of special-casing, but @michaelficarra and @ljharb had reservations. Could you elaborate what these were? (feel free to edit this comment so we have all the pros and cons in one place)
Split out of #75 (comment)
Reasons to special-case:
requires constructor implements protocol { ... }is a footgun.requires constructorcreates aprotocol.constructorsymbol, but inProtocolinstances,protocol.constructorshould point toProtocol. And whileprotocol.prototypewould be blank, it does break assumptions about whatobj.prototypeis, and prevents us from usingprotocol.prototypefor inheritance.Reasons to not special-case:
I’m personally moderately strongly in favor of special-casing, but @michaelficarra and @ljharb had reservations. Could you elaborate what these were? (feel free to edit this comment so we have all the pros and cons in one place)