|
|
|
|
|
by tom_mellior
3297 days ago
|
|
> Doesn't whether a language is compiled or interpreted have an effect on the type system? The question is not well-posed. Would you call Haskell or OCaml "compiled" languages? They certainly can be compiled to machine code, and often are, but both also have interpreted versions. Would you call Python an "interpreted" language? There are compilers from Python to machine code, which are more or less successful at optimizing away type checks. Being compiled or interpreted (or one of the many intermediate things) is not so much a language property as a property of the implementation. That said, there are of course some correlations. Python code can heavily inspect and modify itself and its execution context. This kind of thing is easier to do in an interpreter, and it's much easier to do with a dynamic type system. Dynamically typed languages also tend to be interpreted because the dynamic typing incurs runtime costs anyway, so often you would not win a lot of performance by simple ahead-of-time compilation. (Of course, if your goal is to have a compiled implementation without dynamic type checks, you will design a static type system.) |
|