3 ms·
Do you mean you want an interactive environment to just write small code samples while learning? Or do you want to do your development after learning in a REPL?
by throwaway17_17 4y ago
Do you mean you want an interactive environment to just write small code samples while learning? Or do you want to do your development after learning in a REPL? I think those are two very different goals.
As to Zig and Rust’s lack of REPL, they are both ahead of time compiled to executable languages. It is not super common for REPLs to be developed with any real frequency or faithfulness. (this is a little different in the functional world for some reason, Haskell, ML, etc have very thorough REPLs, and Koka’s REPL is great).
- lolinder 4y agoREPLs make a lot of sense in the functional world where everything is an expression. These languages tend to encourage writing lots of small, referentially transparent functions, which are easy to write and test in a REPL. Because the referentially transparent, when you're happy with them, you can copy what you wrote directly into your code. I think you don't see it used as much in the imperative world because each line of code tends to depend a lot on context that isn't immediately available. When you make a mistake in the REPL, you probably altered state, which means you have to run everything again from scratch to know if your corrected flow actually works. If you're going to run everything again anyway, you may as well just be working in a file with a proper text editor and a good test framework. (An exception to this might be Ruby, whose Smalltalk heritage gives it a good interactive programming legacy to build on.)
- Tozen 4y agoYet strangely Vlang has had REPL since at least back from 2020 (https://youtu.be/Pvbv4b9TibA https://youtu.be/Pvbv4b9TibA), a year after the language was released. Don't think it's as impossible as it is being made out to be here. Just like comparatively, Vlang had a self-hosted compiler the first year it came out, but Zig did not achieve this until this year (which is around 6 years after its release).