3 ms·
> Does anyone have a real-world example of where this is applied? When you want to make an array of different structs that can be used in a homogeneous way. Fo
by kristoff_it 4y ago
> Does anyone have a real-world example of where this is applied?
When you want to make an array of different structs that can be used in a homogeneous way. For example I made a Redis client library that has a bunch of commands implemented as structs (GET, SET, etc). You can't just put them into an array directly because each is its own type, but they all support being sent to Redis when passed to a client instance.
Putting those commands into a tagged union helps with the creation of things like interactive CLI clients.