Are they any other usable compiled languages with a REPL?
Are they any other usable compiled languages with a REPL?
http://www.insectnation.org/howto/problems-with-root
Really, IMHO, jumping back and forth between the editor and the REPL with constant reloading is a better approach than pasting things into the REPL. I remember when I was playing with Common Lisp, I would always have trouble keeping the code on disk and the code loaded into the REPL synced.
ghci Module.hs
*mess around*
:e *this opens Module.hs in vim, and reloads afterwords.*
*mess around some more*
It's the best programming work-flow I've found in any language.Then you're doing it wrong. Most people doesn't type directly into the REPL, they open up a separate buffer in Emacs and play in that. The REPL is just for small tests. There is no such thing as 'keeping the code synced'.
If you do things this way, the state of the running lisp interpreter depends on the entire history of the coding session. Each time you add a new definition, you mutate the interpreter's memory. There is no guarantee that the current state matches what you would have if you recompiled the entire system from scratch.
On the other hand, the usual style in Haskell development is that you write a function definition and then hit the "reload" key combination, and this makes the state of the repl exactly the match the contents of the file. It throws away the results of any commands you ran in the repl in the meantime.
(This seems like an interesting cultural difference, something like "Haskell/ML/Java/Scheme programmers think of a program as a text, Common Lisp/Smalltalk programmers think of a program as an OS process").
I haven't used either Distel or SLIME extensively enough to say if it's comparable, but it looks fairly similar.
What I think still sets Lisp and Smalltalk apart, is their environments at Xerox PARC.
We are still far from having back this type of live editing experience in more mainstream languages.
Plus, most don't implement Lisp's READ EVAL PRINT LOOP, but a simpler command line interface.
Take this simple example:
> (+ 1 "foo")
The value "foo" is not of the expected type NUMBER.
[Condition of type TYPE-ERROR]
Restarts:
0: [USE-VALUE] Use a new value of type NUMBER instead of "foo".
...
> 0<RET>41<RET>
=> 42
>I was part of the team that wrote the original Open Source implementation (under GPL terms) named OpenBIOS. The project now also hosts all kinds of other implementations that were later published under BSD terms by their owners (and had 10+ years of market experience under their belt at that time).
When FORTH started out, one of its differentiators was its live environment: you could test one step (part of an algorithm or similar) at the prompt, then define a "word" (= function) that implements it using the statements you tried, repeat until you finished your program using the words you defined earlier.
Erlang and Elixir, a new language for the Erlang VM with a different syntax, are compiled languages with REPLs. I also think about Scala and others for the JVM, but I have a feeling you do not think of those as examples because of the VM or the lack of native code compilation. I could be wrong.
- Create an interpreter library for language X
- Offer a GUI/CLI application using the said library
Not all repls need to work at function level like LISP does.