Re:Static Duck Typing in Python with Protocols
by dragonwriter on Tuesday November 23, 2021 @12:17PM
(#29320385)
> There are definitely languages where you could easily differentiate between a "length-int" and a "coordinate-int" in the type system
Python, via the shared portion of the type system enforced by the major type checkers, is one of those languages.
The fact that a particular library doesn't choose to do this doesn't mean the type system doesn't fully support it.
I disagree. There are definitely languages where you could easily differentiate between a "length-int" and a "coordinate-int" in the type system, while still representing it as only an int in memory at runtime.
I belive both Haskell and Ada can do this for instance.