| This guy was a professional C++ programmer for a couple of decades so he probably came across generics. I think it's possible you didn't catch the parts where he talks about what he wants from his data structures. There were 2 key pieces: + that he can transport them between environments, possibly remotely, possibly written in different programming languages + that parts of the system only need to know about parts of the data structure. More, that as the data structure is passed around the system, only the producer and consumer of changes to the structure are affected by the change. I'm not aware of any static type system, with generics or otherwise, that would meet these goals. At least not post-facto and highly artificially. Whether or not you agree with the priority he gives to these goals is, of course, a different matter. |
This is pretty easily solved in static languages with "serializable" interfaces, which can usually be automatically derived. E.g., in Rust, you can use #[derive(Serializable,Deserializable)], in OCaml, you can use [@@deriving sexp]. This also allows you to know at compile time which types can safely be serialized. In Clojure, if you have a type that contains an InputStream of some sort, it's not reasonable to serialize it. But you won't find out until runtime, when you happen to have an instance of that map with the InputStream.