They shouldn't be. Here is another bit of my old examples with made-up syntax from above replies.
let mainStageTonight =
Set<MusicPerformer & Comparable..?>([FreddieMerqurie(), JimmyHendrix()])
//can store any musician whose performance quality can be compared
protocol MusicPerformer: Comparable {
var crowdExcitement: Int { Int.random(in: 0..<9) }
func singASong() { print("...doing some performance...") }
func < (lhs: MusicPerformer, rhs: MusicPerformer) -> Bool {
if lhs.crowdExcitement < rhs.crowdExcitement { return true }
if lhs.crowdExcitement > rhs.crowdExcitement { return false }
}
}
struct FreddieMerqurie: MusicPerformer, Comparable {
func singASong() { print("You have been rocked!") }
let crowdExcitement: Int
let wasOnDrugs: Bool
func < (...) ...
}
struct JimmyHendrix: MusicPerformer, Comparable {
func singASong() { print("Such powerful riffs!") }
let crowdExcitement = 10
let whatever: ...
func < (...) ...
}
//this means that even though FreddieMerqurie and JimmyHendrix are
//different things, they still can be compared on how they do music
//while FreddieMerqurie's and JimmyHendrix's can have different measurements
//when comparing to themselves
//but there is a critical difference:
//while these musicians should be compared with identical standards
//(should be compared as MusicPerformer s)
//they also should expose unique singing
for performer in mainStageTonight { performer.singASong() } //You have been rocked etc
//whist
mainStageTonight.max() //shoud compare them as MusicPerformer s
Don't you agree that this is a sound semantic?