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.
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 likefoo_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:
The update above could be represented by something like
state_fupd (K 1) (K 2) I, with theIindicating a null update ofbaz.