5 ms·
It's not great in some cases, but "one hand tied behind your back" really is overstating things. In most cases you probably should limit things to simple types
by arp242 3y ago
It's not great in some cases, but "one hand tied behind your back" really is overstating things. In most cases you probably should limit things to simple types and collections (primitives, simple collections such as structs and arrays), using more complex modellings like sum types only when there's no other good solution.
- frou_dh 3y agoIf it's considered advanced, that's only because it's been left out of many languages and so people have unfamiliarity. It's the dual of product types, the other side of the same coin.
- arp242 3y agoI said "more advanced", not "advanced". If I see that a value can have two or more types then obviously this is "more advanced" (or perhaps better, "more complex") than if it's just one type. Sometimes this makes things better. Sometimes it doesn't.
- frou_dh 3y agoProgrammers are in the business of understanding well-defined concepts like this, so we will cope. > Sometimes this makes things better. Sometimes it doesn't. Exactly, and that's why you want to have both techniques available, and the data modelling is the judicious interplay of both. If you'll excuse me I'm going to go walk AND chew gum. Or should that be OR :)
- arp242 3y agoOf course it's possible and people can "cope". A lot of things are possible and people can "cope" with a lot of stuff, but that doesn't mean it's good, isn't overly complex in some cases, or is the best solution. This is just a dismissal instead of an argument, and one that can be applied to almost anything.