Re:Type hints – a mediocre programmer's reaction (2015)
by jstimpfle on Thursday March 17, 2016 @06:02PM
(#11307986)
This. Types, except for those built-in to the language, are not for APIs. But they can be great for internals if you don't overdo it.
For example, Perl6 has Subset (types), which is a great feature. You could make a subset type of Str (a built-in type) which contains only strings that match a given pattern (e.g. URLs, user-ids, or shell-safe strings) and still benefit from all generic string code.
For example, Perl6 has Subset (types), which is a great feature. You could make a subset type of Str (a built-in type) which contains only strings that match a given pattern (e.g. URLs, user-ids, or shell-safe strings) and still benefit from all generic string code.