Symbol.equal protocol

class Sample {
   constructor(value) {
      this.#internal = value

   [Symbol.equal](input) {
      if (input instanceof Sample) {
          return this.#internal === input.#internal
      return false

const foo = new Sample(1)
const bar = new Sample(1)

foo === bar // here change `Strict Equality Comparison` semantics?, bar) // ?
// or new grammar?


In general this seems like a good goal, and assuming we have a Symbol protocol, would be relatively trivial to achieve.

This idea from @ljharb (email conversation)

This is an existing proposal:

1 Like

The proposal only Array?

That’s a stage 2 question - proposals before that are focusing on problems to solve. However, there would likely have to be a protocol to solve the desired problem with arrays.

1 Like