2 ms·
Sorta. It is dynamic in that the "type" of the data can literally change as you use it. I don't have to say that an input is rational, and it may only become
by taeric 4y ago
Sorta. It is dynamic in that the "type" of the data can literally change as you use it. I don't have to say that an input is rational, and it may only become one after I use it in a way that requires that.
- masklinn 4y agoType 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.