21 ms·
Not even sure how it is even possible to implement every trait. Wouldn't it be the opposite? It implements no traits?
by darksaints 6y ago
Not even sure how it is even possible to implement every trait. Wouldn't it be the opposite? It implements no traits?
- GolDDranks 6y agoOne could argue that because the bottom type is a subtype of all other types, it must to implement all the traits that any other type implements. Traits are similar to interfaces in this regard, and it's pretty clear that subtypes must implement the same interfaces their supertypes do. If not, the values of the subtype wouldn't conform to the Liskov substitution principle. The special case of the bottom type, however, is made possible by the fact that it doesn't have values, so Liskov substitution principle is irrelevant in practice. It's pretty clear, however, that 1) it's kind of weird to do a full reversal on how subtypes work in one case (implements all the traits of the supertypes) versus others (doesn't implement any trait). 2) you want your types to be maximally flexible, so implementing more traits is good, because it allows one to use the type in more situations.
- lmm 6y agoThe whole point of a bottom type is that it's impossible to actually have an instance of it. It implements everything in a principle-of-explosion sort of way.