Está bien. Esta no es realmente una pregunta, sino una epifanía que tuve hoy y que me gustaría compartir, porque no sé si alguien se da cuenta.
Considere el siguiente código:
function Id(obj) { return obj; } class Meta extends Id { #data; constructor(obj, data) { super(obj); this.#data = data; } getData() { try { return this.#data; } catch (ex) {} } setData(value) { try { this.#data = value; } catch (ex) { new Meta(this, value); } } static get = Function.call.bind(this.prototype.getData); static set = Function.call.bind(this.prototype.setData); } var obj = Object.freeze({}); // !!!! frozen console.log(Meta.get(obj)); // undefined Meta.set(obj, "test"); console.log(Meta.get(obj)); // "test" console.log(Reflect.ownKeys(obj)); // Array []Como puede ver, agregué una variable privada a un objeto congelado externo al que solo se puede acceder con mi código.
Gracias por leer y disfrutar!!!!