3 ms·
> Structs are often horrible in practice if you need even a bit of polymorphism I think that's what he is saying. That it's quite a leap from "structs are horr
by alkonaut 6y ago
> Structs are often horrible in practice if you need even a bit of polymorphism
I think that's what he is saying. That it's quite a leap from "structs are horrible in practice" to "structs are horrible if you need polymorphism in conjuction with structs" which is in my experience a pretty rare situation. If you approach structs from Rust or C++ you might expect to be able to form hierarchies of them, but approaching it from Java you are very happy to just be able to create a Point(X, Y) struct.
Even the rust type of enum structs with clever overlapping layouts I find pretty rare use for. The common use case is homogeneous data. If I have polymorphism, I'm likely going to incur some pretty expensive virtcalls etc anyway. At that point I just use classes.