Returning an object with additional fields

How to create a union of fields from various xxx_data types in a natural fashion?

 type a_data = { ... }
 type b_data = { ... }
 type c_data = { ... }
 type d_data = { ... }

 type data_01 = { (* should have fields from b_data and c_data *) }
 type data_02 = { (* should have fields from d_data and e_data *) }
 type data_03 = { (* should have fields from b_data and a_data *) }

The only approach I see currently is to manually define the fields by copy-pasting.

As for assigning id and sid, as was asked originally in the initial post of this thread, I am agree with your approach. In fact, even with objects, I’m ending up with a similar method — instead of extending the original attributes object, I instead create a class that holds a reference to another.