mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-18 10:53:45 +01:00
Add remark that intersection types can mimic having getters/setters at different types
This commit is contained in:
parent
8abad9a07d
commit
9686135d8e
1 changed files with 6 additions and 0 deletions
|
@ -116,6 +116,12 @@ the initial DM. This is unsound, but would support reparenting, and
|
||||||
any solution for reparenting is either going to require whole-program
|
any solution for reparenting is either going to require whole-program
|
||||||
analysis or have unsoundness.
|
analysis or have unsoundness.
|
||||||
|
|
||||||
|
### Separate getter and setters via intersection types
|
||||||
|
|
||||||
|
We could restrict the language to only allow a getter or a setter (but
|
||||||
|
not both) but this is not a restriction due to intersection types,
|
||||||
|
since we can mimic `{ get p: T, set p: U }` as `{ get p: T } & { set p: U }`.
|
||||||
|
|
||||||
### Why separate the getter from the setter?
|
### Why separate the getter from the setter?
|
||||||
|
|
||||||
Separate getters and setters were introduced to TypeScript in response
|
Separate getters and setters were introduced to TypeScript in response
|
||||||
|
|
Loading…
Add table
Reference in a new issue