Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Dart needs a REPL #4409

DartBot opened this Issue · 14 comments

7 participants


This issue was originally filed by

Dart needs a REPL - It's a glaring omission from a modern dynamic language :)


Assigning to SDK for the moment, but there are many pieces in the VM on top of the getting the REPL binary built and included in the Editor.

Added Area-SDK, Triaged labels.


This comment was originally written by

A good place for this Read–Eval–Print Loop would be the Dartium developer tools console (and eventually the Chrome console). Switching the console language between Dart and JavaScript could be achieved with a console switch/setting.

A console REPL would be preferable to a standalone or IDE hosted REPL because it would maintain state like a Smalltalk workspace and allow interaction with the DOM.


This comment was originally written by

A console-based REPL in Dartium/Chrome would indeed be awesome, but this doesn't address the server-side use case.


The Dartium console would be very nice, and exists now. You can't define a top-level function, but you can define one that's assigned to a variable or passed as a closure e.g.

[1, 2, 3].forEach((x) => print(x));
var f = (x) => x + 2;
[Dart Function] {}
blah(x) => x + 3;
"'': error: line 2 pos 9: ')' expected
blah(x) => x + 3


This comment was originally written by

where this an improvement over ne REPL at all, it'd be much more
awesome to just being able to fire up the dartvm in repl mode. i got
somthing like "dart -i" in my mind...

Am Di, 4. Feb, 2014 um 9:41 , schrieb:


This comment was originally written by

#­5: This doesn't work for me using the developer tools console ('SyntaxError: Unexpected token >' on the first line in Dartium 32.0.1700.58 (247491))... what am I missing? Is the Dart console somewhere else, or is there a setting to change?

#­4, #­6: I'll create a separate issue for a Dartium console if there isn't one, and this issue can stay focussed on a standalone REPL.


This comment was originally written by

I've found that I have to toggle the selector at the bottom and near the
left-middle of the tools window that says something like javascript context
to one of the dart packages. Once you do that, you should be able to
execute Dart code. Depending on what you need to access within your own
codebase, you may need to be more selective in your package choice.

I've only been using Dart for about 3 weeks, but I have to say that using
the Dartium web tools vs the Editor has ramped up my productivity (and I
just found out about it in the last 5 days :-) ). I think it should be
promoted more.

Hope that helps,


This comment was originally written by

Thanks Jesse, that works! Very neat and useful...

There is no need for a new Dartium console issue and this issue can be returned to its standalone REPL focus. Apologies for the noise.


Issue #17133 has been merged into this issue.


This is still the single most-wished-for feature I would love to see as part of the Dart SDK.

Of course, ideally a Smalltalk-like workspace/kernel would be perfect, but a CLI REPL would already help a lot. I'm liking the language so much I'd like an opportunity to use it outside the context of compile-to-js web applications and standard backends, but lack of tooling gets in the way.


I don't have a use case where a REPL would help. Out of curiousity, what do you want/need it for?
With fletch a Dart interpreter is in development and I expect a Dart REPL will be much easier to implement using an interpreter.


I know it's not a full REPL, but is a really useful tool for exploring Dart.


Dartpad really isn't a REPL at all. But depending on exactly what you're looking for, Devtools or Observatory both provide the ability to evaluate expressions, and so does the IntelliJ debugger. Devtools can declare variables, and you can assign functions to them.

 var foo = (x) => x + 42

but you can't define new functions or classes. Observatory has both debugger-like evaluation and the ability to evaluate expressions in the context of objects being inspected. I'm not sure what Observatory allows in terms of defining new entities, but it's been discussed there. If we're going to get something with those kind of capabilities Observatory seems the most likely thing to grow into that. I could wish the debugger there looked more like a REPL and less like GDB, but that's just cosmetics.

As far as a use case for where those kind of capabilities would help ...


I agree with Observatory being the prime candidate, if such a thing is to be done -- the networked protocol for debugging is really great, too.

As about use cases, it would be great to do fraction of the same live-coding and exploration of libraries/language/concepts as I do with Jupyter/IPython, in Dart. Even if I know the language itself well enough, the ability to build things live really helps with exploring possibilities and new concepts.

I have not done any HTML5 gamedev with Dart yet, so I'm not sure how much that is to apply, but being able to write new functionality and classes on-the-fly might be good for solving certain problems there as well. Without using compilation and live reload, that is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.