WeakSets are perfect for branding and are how I would expect web platform class 
branding to be explained.

```js
const foos = new WeakSet();

class Foo {
  constructor() {
    foos.add(this);
  }
  
  method() {
    if (!foos.has(this)) {
      throw new TypeError("Foo.prototype.method called on an incompatible 
object!");
    }
  }
}
```

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to