Curious about needs for private record fields

Did you mean the following?

type ast = private {
   view: ast_view;
   ty : type_;
   id: generative_id;
}

Declaring the record as private prevents the creation of other records with the same ID. However we can still access the id field. Maybe the user would use it as a key in a hash table or something - but if it’s an implementation detail that will change and we want to prevent them from referencing the field or at least reading from it. That’s the motivation for declaring a field as “hidden”.