I think the
: Int solution wouldn't be as terrible if we had
internal-only conformances, so you could use the integer values within your own module but not have them leak to clients. I've wanted to do this a number of times (mostly when wrapping C types), in situations both involving ordering and not. I'm less concerned about the associated value restriction because chances are if your
enum has them, your comparison logic is going to involve something more than just the
But for what it's worth (especially given the observation about
CaseIterable), I could see derivation of
Comparable for enums without associated values based on source order as being fairly uncontroversial.
Doing the same for
enums with associated values or for
structs feels a bit more wishy-washy, but maybe if it's well-documented it wouldn't be too bad...