How does this interact with Proxies?
Per your example in https://github.com/wycats/javascript-private-state#private-slots-are-lexical-and-class-private - what if another is a Proxy for DataObj?
What would the proxy traps look like if the proxy is able to intercept data slot getting/setting? If it's not able to, would data slot access simply pass through any proxy?
There is intentionally no MOP operations (proxy traps) for accessing private slots. This was a security requirement.
From a proxy perspective private slots work exactly like internal data slots. The default trap handlers do not transparently allow access to either internal data slots or private slots. But a membrane style proxy can be written whose handler will transparently all such accesses..
Makes sense - how would I write a proxy such that another.#data would work the same as if it wasn't a proxy?
A fully transparent membrane proxy is too complicated for me to try to do off the cuff. I'm sure that Mark Miller to Tom Van Custem could point you at a complete example.
The problem is the same as for built-ins. The default method invocation passes the Proxy rather than the target as the this value to the method. But, the Proxy object fails any internal/private slots accesses that the method might perform.