>By merging them. Structs are product types. If you merge them, you get a bigger product type. You don't need inheritance (ADTs) for that.
Merging structs and inheritance are fundamentally the same thing.
>How fundamental is inheritance if it can be fully replaced by simpler building blocks?
It can't be replaced. Combining Foo and Bar in the way you're thinking involves additional primitives and concepts like nesting. If Foo and Bar share a same property the most straight forward way of handling is overriding one property with the other. Overriding IS inheritance.
We aren't dealing with product types in the purest form either. These product types have named properties and you need additional rules to handle conflicting names.
In fact once you have named properties the resulting algebra from multiplying structs is not consistent with the concept of multiplication whether you use inheritance or "object composition"
Merging structs and inheritance are fundamentally the same thing.
>How fundamental is inheritance if it can be fully replaced by simpler building blocks?
It can't be replaced. Combining Foo and Bar in the way you're thinking involves additional primitives and concepts like nesting. If Foo and Bar share a same property the most straight forward way of handling is overriding one property with the other. Overriding IS inheritance.
We aren't dealing with product types in the purest form either. These product types have named properties and you need additional rules to handle conflicting names.
In fact once you have named properties the resulting algebra from multiplying structs is not consistent with the concept of multiplication whether you use inheritance or "object composition"