Search code examples
.netf#read-eval-print-loopfsi

Is fsi.exe an interpreter?


I've read that fsi.exe (F# Interactive) is not a true "interpreter" in the strict sense because it compiles F# code on the fly and displays its output.

I am under the impression that the word "interpreter" applies to "dynamic" languages (i.e. JavaScript) and therefore does not apply to F# since it is a compiled language.

Is this a fair assessment? Or can compiled languages be "interpreted"? Or is this just a semantics issue?

Appreciate any help.


Solution

  • A difference between compilation and interpretation is blurred. Many languages perceived as "interpreted" are in fact often compiled to a native code (e.g., JavaScript with v8). Some implementations of the most dynamic feature of the dynamic languages, eval, are just wrappers around a compilation (e.g., in SBCL).

    And of course REPL has nothing to do with compilation or interpretation, REPL can be built on top of any execution model. fsi is just a REPL, and it is using the same F# compiler core as fsc.