tc39 / proposal-mass-proxy-revocation

Proposal for revoking proxies en masse.
MIT License
5 stars 1 forks source link

Proxies in the wild: chai assertions #18

Open ajvincent opened 1 year ago

ajvincent commented 1 year ago

Chai Assertions expect("foo").to.equal("foo");

Under the hood, this uses Proxy objects to build up a chain of clauses: expect returns a chai.Assertion, which then "proxifies" (or creates a very simple Proxy) to dynamically add clauses such as "to" or "equal" via a very basic set of ProxyHandlers and wrappers which are themselves proxies.

This doesn't qualify as a membrane, because it's not nearly complete. For this use case it doesn't have to be.

I suspect this is not a valid use case for mass revocation, because these proxies are one-time-use. Nobody is supposed to write const expectation = expect("foo") and reuse the expectation later.

FYI, I've added labels for "potential use case", "use case" and "invalid use case". The intent is to document where this might or might not be useful beyond membranes.