Constrain protocol usage outside the module

I must be botching my message. Let me restate again: I’m arguing that protocols are fundamentally different from types precisely because you would never elide a type, not even (as you point out) an uninhabitable type. This is why I argue it’s entirely consistent for classes not to be open by default and protocols to behave differently.

We would definitely not have that, and for at least three reasons:

  • A “closed” (now called “frozen”) enum as envisioned can never have any cases if it does not currently have cases. What you call a “closed” protocol is only forbidden from ever having external cases. When the design is completed, we will be able to guarantee for all time that public frozen enum Never will always be uninhabited. But in your design it would be possible for a later version of the standard library to conform a type to public protocol Never. That is not a suitable design for a bottom type.

  • An existential P does not conform to protocol P. However, in a completed implementation of a type system with a bottom type, the bottom type would conform to all protocols. We’d never be able to complete a design where Never is both a protocol and a bottom type. This cannot even be improved by somehow making P conform to P: the protocol P would not be at the bottom of the hierarchy because the existential type P would then conform to it. In other words, the bottom type must always be a type and not a protocol. Except, with this protocol-based design, you would have both a bottom type and an identically named extraneous protocol P to which it conforms with no particular purpose.

  • Never receives no special treatment from the compiler. Any uninhabitable type behaves identically to Never. You can demonstrate this for yourself by creating your own enum with no cases: you will find that you can use that type in place of Never. Even if the theoretical barriers above did not exist, it would not change the fact that enums with no case are uninhabitable and therefore a way of expressing the bottom type. It would not make sense to introduce new syntax to enable a second way to express the same thing.

This is all to demonstrate, in a different setting, how types and protocols differ in some fundamental ways.