I think Dart needs a REPL to be more productive and accessible.
This is the Scala REPL:
and Dart currently lack it.
What about dartpad.dartlang.org?
I mean a REPL running on my local computer, out of box.
/cc @mit-mit
Thanks for the suggestion @hepin1989, this is something we've discussed a few times, but don't have a concrete timeline for.
@mit-mit Thanks for your update; REPL is really handy for offline learning, practicing, looking forward to that.
And here we are, 35,556 issues after #4409
Often you want/need to try things out locally, right away, that require the environment that you load in Pubspec. Communicating with vaguely documented APIs is a typical example. This absence is a real productivity weakness for the language.
The lack of a REPL is indeed a pain point.
I will say that just running local code in VS Code (which respects pubspecs) isn't terrible, but it lacks the immediacy of Lisp/JS/etc.
Well-put. Having the environment at your fingertips isn't the unique thing with the REPL, it's being able to execute one-liners and set up class instances that you want to play with in a flash, with state that isn't polluted by what's going on in the app itself.
And here we are, 35,556 issues after #4409
How I got on board of Scala 銆丆lojure and Elixir is they all have a REPL...
+1. A Local REPL is essential when playing around with unfamiliar libraries.
How can DART claim to be a modern alternative to JS if it doesn't have a REPL?!?! :)
Found this: https://iiro.dev/2019/08/15/how-to-eval-in-dart/
Nobody yet mentioned unittests as a workaroud, so let me do that now. Instead of experimenting with a REPL, it is quite doable to write unittests either in a separate experimental project, or in the current project itself. IDEs provide a way to quickly run only a selected unittest, which approximates sending a line of code into REPL聽by pressing the Enter key. Unittests also scale better to programs that have 5 or more lines of code and can be checked into source control for sharing or reuse.
I'd love to reduce my dependency on Python!
Why? Python is a good calculator :D
You don鈥檛 need to write a unit test to experiment with code, you can just write code. The whole point of a REPL is to have an immediate experience; there鈥檚 no difference between writing regular code or a unit test other than a unit test has more boilerplate than just writing code.
Sure, that's why I call my approach a workaround. The whole point of unittesting is to have immediate feedback, and IDEs tend to have decent support for e.g. shortcuts to run test under cursor and so on; that's why it can be used as a poor person's substitute when a REPL is not available.
Most helpful comment
I mean a REPL running on my local computer, out of box.