Anonymous record types

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 = ...
      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.

I don’t know what talk you’re referring too, so it’s hard to guess.

But when I hear arbitrary combination I’m thinking more nested maps of maps.

In principle Hickey brought the Duck-Typing argument. With statically typed languages that support structural typing pretty much all of DT is available there as well and it addresses those points.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.