4 ms·
Personally I think that just makes code harder to read, and more difficult to refactor. You get benefits from leaving things inferred in some places when refact
by leshow 7y ago
Personally I think that just makes code harder to read, and more difficult to refactor. You get benefits from leaving things inferred in some places when refactoring, preventing you from having to change a bunch of additional signatures just because you made a single change.
And the language you use is probably using aliases too in it's stdlib, so why hate on aliases? They are a great way to abstract away the details.
The boundary I prefer is to explicitly type function signatures, and leave everything else (or as much of it as I can) inferred.
- Crinus 7y agoTBH i only have statically typed languages in mind (like C++ and Free Pascal), so i'm not sure how it'd work in a dynamically typed language with type annotations, but to refactor i'd just... change the type and then work through the compiler errors to find the places that need their type updated. Some IDEs also provide you with tools to find all those uses and even can do the refactor themselves. Your refactor will contain more lines of code since it'll need to also contain the updated use sites, but i do not see that as a problem at all - and even if it is one, it is only a short term small problem that is certainly not as important as having the code more obvious and readable in the long term (assuming of course you feel the same about readability as i do - after all as i wrote in my message above it is a subjective issue :-P).
- leshow 7y ago> dynamically typed language with type annotations I'm talking about statically typed languages also, just ones with inference. Haskell, Rust, Ocaml, F#, Go, etc, and increasingly languages like C# and Java are adding more and more inference. Your response makes me think you don't really get what type inference is.