Skip to content

Should constructor and prototype be special-cased to always be strings? #84

@LeaVerou

Description

@LeaVerou

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Agenda+To be discussed in next breakout. Remove when actually discussed and resolved.needs consensus

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions