Anonymous record types


#1

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.


#2

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.


#3

https://lispcast.com/something-i-missed-in-rich-hickeys-last-keynote-clojure-conj-2017/


#4

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.