Hacker News new | ask | show | jobs
by FunnyLookinHat 2278 days ago
Maybe a dumb question... but how would a compiled language provide a REPL? Isn't a VM of some sort a requirement to provide anything that we'd call a "REPL"?
4 comments

REPL stands for read eval print loop. Being "compiled" is not a property of the language, but a property of the implementation. You can provide a "compiler" for python or "interpreter" for C. In Rust's case "eval" part of REPL would do compile->run. Note that even "interpreted" languages such as python are internally compiled (but this is not the output), e.g. cpython compiles python to python-byte-code, and then executes.
Aha that's a good way of putting it - thanks! I guess my experience with Go and C has made me only expect REPLs with dynamic languages that use VMs. Some of the other comments also noted that Haskell and Erlang are compiled but also provide REPLs.
Haskell is compiled and has a decent repl
It's possible to be both compiled and have a vm, like jvm and erlang (notably, erlang has a repl)
Lisp is a compiled language with a REPL.