4 ms·
Yep. You can, of course, make a similar argument for Scheme. But you don't get a very interesting type system out of it. Perhaps I should have written "... non
by tonyg 9y ago
Yep. You can, of course, make a similar argument for Scheme. But you don't get a very interesting type system out of it.
Perhaps I should have written "... nontrivially statically typed."
- naasking 9y agoSure, but to bring it back to the original question, the fact that you can trivially distinguish floating point from word types already means statically typed languages are easier to optimize than dynamically typed languages for numerical programs. And there are all sorts of optimizations like this that simply aren't available to dynamically typed languages. Tracing JIT can only take you so far.
- tonyg 9y agoOK, but that wasn't the original question. (There are also all sorts of optimizations that can't be done statically, so I guess there's that.)
- naasking 9y agoThe original question asked whether static typing is needed when maximal performance is required. If we understand "maximal" to mean literally, "no more performance can possibly be squeezed out", then it simply is. Static typing might not be sufficient for this case, but it is necessary.
- tonyg 9y agoI think those few, crucial pieces of hand-written assembly language one sees from time to time disagree with you. (Modulo your observation that assembly languages are trivially statically typed.)
- naasking 9y ago> I think those few, crucial pieces of hand-written assembly language one sees from time to time disagree with you. I still don't think so. For example, plenty of silicon is spent on branch predictors simply because addresses and integers aren't distinguished, in general, thus permitting more expressive but costlier code. Execution would be much faster if integers and addresses were forced to be distinct. Static typing pretty much always improves performance.