Hacker News new | ask | show | jobs
by valw 1945 days ago
Compiling means translating a program from one representation to another. Executing a program always involves a combination of compilation and interpretation (example: Java usually runs by compiling it to Java bytecode, which is then interpreted by a Java Virtual Machine).

The widespread belief that compilation and interpretation are mutually exclusive is unfortunate, as is the artificial distinction between 'compiling' and 'transpiling' we sometimes hear, because these misconceptions show that programmers today are a bit confused about the essence of how programs actually run. It's a pity we don't have more cultural interest in such things, because mastering those notions can really improve software engineering.

1 comments

So as someone who has mastered those notions is this compiling, interpreting or neither?
Phel is a compiler, because its output is code. PHP is an interpreter, because its "output" is the effects of executing code.

(edit: to the GP's point, PHP does contain a compiler within it, because it translates source to bytecode as part of execution, but that's an implementation detail. As a product it is strictly an interpreter)