Re:Type hints – a mediocre programmer's reaction (2015)
by solidsnack9000 on Friday March 18, 2016 @02:34AM
(#11310289)
Aren't protocols just a particular kind of abstract type? In Swift, "interfaces" or "traits" are literally called protocols.
[ Parent
| on HN ]
Re:Type hints – a mediocre programmer's reaction (2015)
by duaneb on Friday March 18, 2016 @05:51AM
(#11310762)
It'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.
Re:Type hints – a mediocre programmer's reaction (2015)
by zaro on Friday March 18, 2016 @03:32AM
(#11310405)
If 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.
Re:Type hints – a mediocre programmer's reaction (2015)
by solidsnack9000 on Friday March 18, 2016 @02:44PM
(#11313914)
I 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.