3 ms·
Static typing is in my opinion the lazy language designer's way out. Yes, it allows for some introspection but only because the programmer has to type in all th
by bjourne 8y ago
Static typing is in my opinion the lazy language designer's way out. Yes, it allows for some introspection but only because the programmer has to type in all this type information! In 2019, we can do so much better.
For example, development consists of typing some code, running it, typing some more, running it again and so on. The run time likely already guesses (correctly) the types of most variables for optimization purposes. But then this information is thrown away for no good reason. It can trivially be reused to provide context-sensitive auto-completion and other features.
In general, why is editing, compilation and running still treated as three separate steps? Clearly, a lot of information could flow from each step to the other. It's not like a programmer compartmentalizes the job in that way. To him or her its one task which is to write software.
And why on earth do we tolerate editors that doesn't know what a "size" is? Every half-decent programmer knows "size" is a positive integer. Just as we know that "filename" is a string, "temperature" a real and "is_complete" a boolean value. But the editor doesn't. When I write mail_recepient for the umpteenth time it doesn't even try to help me! There is so much low-hanging fruit here just waiting for someone to make better.
- softshellack 8y agoYou should google "hindley milner"
- quickthrower2 8y agoAnd refinement types
- sgillen 8y agoAs to your last point those variables could be anything, even in the simple examples you list. Size could be a tuple with the shape of some multidimensional thing, it could the the string "Large" temperature could also reasonably be a string "45C".
- bjourne 8y agoYes, it "could" be anything. But in practice it rarely is anything other than one easily guessed thing. Which is why Google's V8 work so well. Variable names is one signal that can be used to enhance the accuracy of these guesses.