Skip to content

Commit

Permalink
add a bit about the syntax of exact and inexact tables explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
aatxe committed Aug 5, 2022
1 parent 8496fcd commit c6dc391
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rfcs/exact-table-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ inexact and therefore open to having additional properties, we would include an
type, e.g. `{ x: number, y: number, ...}`. This was originally proposed as an alternative design in
the [width subtyping][width-subtyping] proposal.

We propose these syntaxes (`{field: type}` and `{field: type, ...}`) for exact and inexact tables
respectively because they are fairly lightweight, support anonymous usage, and represent a fairly
mild change from the syntax that we already have. Alternative syntax options like `interface` in
TypeScript would represent a bigger deviation from our current syntax of types.

There are a few apparent benefits to this approach. First, it means that a programmer designing an
API has to make a conscious decision that "yes, in fact, it is sensible to treat all of the unlisted
properties of this parameter as being unrelated to the behavior of this function." The type checker
Expand Down

0 comments on commit c6dc391

Please sign in to comment.