3 ms·
Type inference can do that as well.
by masklinn 4y ago
Type inference can do that as well.
- taeric 4y agoSorta. Inference can't tell how big of a numeric type I have to support based on just the static typing. You probably could just call the data statically typed, but with the idea that the concrete type that you are actually dealing with could be any of a few types. Think a function in Java that takes in a Number, but obviously has to have code to work with any actual numeric types. Even more fun, the code could do basic bounds checking to make sure that the result you are working with fits, such that the code starts with an Integer it is working with, but auto moves to Long, etc. And that is where I wish dynamic typing focused more. It isn't that the type of things is not knowable. Clearly they can be known. And it is nice to have parameters constrained to be within a range of expected types. The actual type, though, is dependent on runtime data.