Skip to content

Explore alternative design for records #2061

Description

@IlmariReissumies

Record updates like st with <| foo := 1; bar := 2 |> currently parses to a stack of calls to separate update functions for each fields under consideration, something like foo_fupd (K 1) (bar_fupd (K 2) st)). A nice thing about this design is that updates that touch few fields can be represented relatively compactly. A less nice thing is that the update functions can occur in any order, which causes all sorts of pain with making rewrites and conversions fire.

An alternative representation that obviates the above ordering problems would be to have a single update function that changes all fields. So if the record type looks like this:

Datatype:
  state = <| bar : num; baz : num; baz : num |>
End

The update above could be represented by something like state_fupd (K 1) (K 2) I, with the I indicating a null update of baz.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions