Attempt to improve printing of record definitions

In particular, if print_datatype_names_as_types is set, attempt to
reconstruct the actual type of the record and print that type, as
opposed to the default behaviour of printing a variable whose name
happens to be that of the record type (and whose type is :ind).