In what sense don’t anonymous record types address the problem that Rich Hickey describes as not being able to use labels and associated data in arbitrary combinations in typed languages?
E.g. in PureScript:
f :: forall whatever. { x :: Int | whatever } -> { x :: Int | whatever }
f whatever = whatever { x = whatever.x + 1 }
main = ...
where
res = f { x: 1, y: "whatever" }
f
accepts an arbitrary record, as long as the key x
is available with something of the type Int
, without having to give that requirement a specific name.
I only recently learned about this feature, but it seems to me that a type system would be much more tolerable with this feature.