4 ms·
No, he puts typing in the interface, and that's indeed typing in a sense, called duck-typing.
by lloeki 14y ago
No, he puts typing in the interface, and that's indeed typing in a sense, called duck-typing.
- ww520 14y agoI think we are talking about different things. Duck-typing doesn't help in depicting what the return type of a function is when looking at the function signature only. You need to look at the function implementation (the actual duck) to tell what the return type is.
- phamilton 14y agoMy point I guess was that with proper abstractions and duck typing you really don't have to care about the type. I only notice something isn't a duck when I try to use it like a duck and it fails - which is surprisingly infrequent.
- ww520 14y agoIt becomes difficult to tell it's a duck when reading code, which was the original complaint. Duck type works when you actually try calling it.