> set(key, value) { > > let data = this[$data]; > > if (!data) > throw new TypeError('this object must be a StringMap'); > > if (!(key in data)) > this[$size]++; > > data[key] = value; > > }
Doh! I wrote that in such a way that an inconsistency cannot be introduced, since `$data` is retrieved before `$size` is changed, and then the mutation on the data object happens without the use of a private symbol. However, I think you get the idea. Probably a better example would have been one where I wanted to mutate two private symbol properties with primitive values, in which case they would both require calls to `unknownPrivateSymbol` when being set. Nathan _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss