Files
react/compiler/packages
Joe Savona 6d75e612fe compiler: Fixtures to show challenge with setters
I quickly experimented with enabling support for get/set syntax. This confirmed my suspicion that these won't be safe without additional work. The "set" fixture example shows how we assume PropertyStore is only a Store effect on the object, but with a setter it needs to be modeled as an arbitrary mutation.

If we were to support getters and setters I think we'd need to:
* Support `this` syntax (maybe limited to just within object methods)
* Enforce that getters cannot mutate any free variables, cannot mutate `this`
* Enforce that setters cannot mutate any free variables (but allow mutating `this`).

In other words, enforce that you're using getters/setters in a reasonable way that matches our modeling (get is a read, set is a store to the object).

[ghstack-poisoned]
2024-05-25 23:19:33 +01:00
..