5 ms·
I would love to see Rust with a REPL. I use Python professionally a lot and have done a fair amount of OCaml in my spare time and both have excellent REPls in
by joshmarlow 10y ago
I would love to see Rust with a REPL. I use Python professionally a lot and have done a fair amount of OCaml in my spare time and both have excellent REPls in the form of `ipython` and `coretop`. Quick experiments with auto-complete is incredibly helpful for exploring a language. That's the only thing I really miss from those languages; when I want to wrap my head around a bit of syntax or a library feature in Rust, I build out a quick little experiment and see if it compiles and behaves as I expect it. With a good enough REPL, that's unneeded.
- Cyph0n 10y agoScala does this extremely well too. Not sure whether or not a snippet will work? Run 'sbt console' and you're in a REPL with all of your code imported.
- joshmarlow 10y agoSomething like `cargo shell` or `cargo repl` that automatically imports whatever crate you happen to be working in would be fantastic. If you had something like that, I imagine you could probably write a Kernel for Jupyter which would be a huge win.
- manaskarekar 10y agoAlthough not exactly a REPL, the rust playground has proven very useful to me for similar purposes. Of course, you need to be online. https://play.rust-lang.org/ https://play.rust-lang.org/
- leshow 10y agocoming from haskell too, i missed this. ghci is really fantastic.
- bjz_ 10y agoI heard a while back that there was some work going into an interpreter for rust's mid-level IR (MIR), with the intention being to support a REPL. Not sure how that is going though.
- tatterdemalion 10y agoThe project you're thinking of is called miri, I don't really know the state of it either. https://github.com/solson/miri https://github.com/solson/miri
- rascul 10y agoThere is rusti https://github.com/murarth/rusti https://github.com/murarth/rusti
- hellofunk 10y agoI assume you mean OCaml's "utop" ?
- joshmarlow 10y agoTechnically yes. "utop" is the extended repl, but "coretop" is "utop" except it all ready has Jane Street Core loaded up.
- agentgt 10y agoFor languages that do not have REPLs I usually just write unit tests. This works particularly well for Java as the Eclipse compiler iteratively compiles and most IDEs will let you run a single method. I imagine a similar stopgap could be used for Rust. I know its not the same but in some ways I have sort of disliked REPLs because its is very easy to accidentally delete or loose what you have type and you might as well make your playing around a test (just my 2 cents).
- tmzt 10y agoThe Dyon[1] language would probably make a good basis for a repl for Rust. It shares many concepts with Rust including a version of ownership. [1] https://github.com/PistonDevelopers/dyon https://github.com/PistonDevelopers/dyon You might also be able to link the repl with Rust Language Server which could be linked with incremental compilation, letting you define modules or pub fn's dynamically.