Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is where I'm really not clear. What makes Python harder to compile than Smalltalk (which had some native compilers - Smalltalk/X) or Objective-C?


Well nobody said it would be harder to compile. However the fact is that there is not a compiler for Python, so unless someone writes one that is a downside. Also, the semantics of Python would likely not lead to efficient compiled code anyway, when compared to something like C, Java, or even Haskell - static languages.


The corners of the language make it difficult to benefit from compilation. Per the language, things like the internals of an instance of a class can be manipulated at runtime, so the compiled output ends up needing to support the entire dynamic runtime.

Cython and Nuitka (among others) do this to varying degrees.


Didn't Smalltalk basically invent the idea of being able to open up objects at runtime? Even Objective-C, with its strong Smalltalk ties, allows for runtime modification.


Any language with eval is probably going to, by default, be interpreted. You can compile a language with eval, but it means you'll need to stick the compiler into every binary with a program that calls eval.


Common Lisp allows all sorts of internal runtime manipulation and is usually compiled to machine code. :-)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: