3 ms·
Static typing has very little to do with what the compiler can say about your code. You can have dynamic languages with very strong type systems and semantics a
by KenoFischer 8y ago
Static typing has very little to do with what the compiler can say about your code. You can have dynamic languages with very strong type systems and semantics as well as static languages with weak semantics. The only difference between static and dynamic languages is whether the compiler enforces completeness of the analysis or not.
- yunfeng_lin 8y agoI am not sure I agree with you. You do need compile time type to generate efficient hardware accelerated code. Python has strong type, but that is only available at run time, which is not useful to generate code. But now python also have optional type. this might be utilized in generating more efficient code though
- KenoFischer 8y agoLook at e.g. Julia for a dynamic system with a strong type system that allows the compiler to reason about the code without forcing completeness.
- yunfeng_lin 8y agoJulia has optional typing which is static as well
- KenoFischer 8y agoAs always in these sorts of discussions, it depends how you define your terminology. However, by most definitions of static typing, Julia's type system is not static. The julia type system is very much a property of the runtime language and behaves as such. It is quite strong, true, but still not statically enforced as you would expect from a static language. In particular, (to the extent that you can identify one), you never get any sort of compile-time type errors in julia.