pub fn record_to_uwd(ty: &TyV) -> Option<UWD<ObType, QualifiedName>>Expand description
Extracts an undirected wiring diagram from a record type.
Returns a UWD when the given type is a record; otherwise, returns None.
The UWD has a box for each field that is itself of record type.
Because record types do not have an explicit notion of interface (say by
distinguishing “public” and “private” fields), there is ambiguity about how
to choose the interfaces (ports) for outer and inner boxes. Two approaches
are reasonable. In the maximalist approach, every field of Object type
contributes a port. In the minimalist approach, only those fields used in a
specialization contribute a port. We take the minimalist approach because
the purpose of this feature is to get a visual overview of a composition,
which is best achieved by minimizing clutter.
A deeper problem is that specializations of a nested record type can refer to fields of arbitrary depth. In this function, any specializations more than one level deep are ignored. To capture these, one might look for a “nested UWD” data structure.