3 ms·
The line of reasoning here seems completely backwards. Type hinting should be used in libraries and other pieces of code where type ambiguity can lead to unexpe
by woeirua 4y ago
The line of reasoning here seems completely backwards. Type hinting should be used in libraries and other pieces of code where type ambiguity can lead to unexpected results. In my experience, that tends to be in "infrastructure" like pieces of code. I think the author confuses the fact that many "infrastructure" libraries are relatively old, and thereby existed _before_ type hinting existed with some kind of conscious choice by the developers.
- Bedon292 4y agoAnd in my experience, for most of those cases there are additional type libraries that correspond with them and it just needs to be installed separately if you want to use the types.
- hbrn 4y agoThis, 100%. Infrastructure by definition is supposed to be stable with well established interfaces, this is a perfect match for types. Business logic is constantly evolving, focusing too much on types will cause you to be disconnected from business value and you'll just waste time fighting typing system.