2 ms·
Aren't protocols just a particular kind of abstract type? In Swift, "interfaces" or "traits" are literally called protocols.
by solidsnack9000 11y ago
Aren't protocols just a particular kind of abstract type? In Swift, "interfaces" or "traits" are literally called protocols.
- zaro 11y agoIf you go that route, anything can be abstract type. I tend to see it like: type is what this object actually is, and protocol is how we interact with it.
- solidsnack9000 11y agoI see where you are going. But I'm sure we can agree that both concrete types and protocols would be handled by a "type checker". If ever there were a language where you'd want to be looking at protocols and not concrete types most of the time, it would be Python.
- duaneb 11y agoIt's objective-c terminology originally. Interfaces, traits, protocols are all fairly interchangeable. Objective-c already used @interface to declare the public method list of a concrete type, so it's a little odd in this case.