_This issue was originally filed by demis.b...@gmail.com_
Dart needs a REPL - It's a glaring omission from a modern dynamic language :)
_This comment was originally written by [email protected]_
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 JayYoung990...@gmail.com_
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));
1
2
3
null
var f = (x) => x + 2;
[Dart Function] {}
f(5)
7
blah(x) => x + 3;
"'': error: line 2 pos 9: ')' expected
blah(x) => x + 3
^"
_This comment was originally written by martyglaubit...@gmail.com_
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 ,[email protected] schrieb:
_This comment was originally written by [email protected]_
_This comment was originally written by jesse.riggi...@gmail.com_
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,
Jesse
_This comment was originally written by [email protected]_
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 dartpad.dartlang.org 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 ... http://i.imgur.com/9q583jQ.gif
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.
Not 100% related but imho Dart support for Jupyter would be amazing.
As far as I understand we'd just have to provide a Jupyter kernel implementation:
https://github.com/ipython/ipython/wiki/IPython-kernels-for-other-languages
@tosh Jupyter is just a fancy REPL. Once you have a REPL, "just providing a Jupyter kernel implementation" is easy. What Dart ultimately aims for is a live programming, though, which is a step more ambitious than REPL with a notebook-style interface. Check out https://groups.google.com/forum/#!topic/dartino-discuss/RxmXjJaASqg for a discussion on that.
@alan-knight Good work-around for functions, but is there similar way to define classes? There is no "anonymous class" AFAIK.
@matanlurey Could you please explain, why this is closed as obsolete?
As far as I can tell dart still hasn't a proper REPL.
I'm new to dart, so I'm sorry if I'm missing something obvious..
As a further thought: DartPad doesn't work too well with screen readers as far as I can tell (I'm using NVDA), and a command line REPL like those found in Python or Node would be great.
I personally find that functionality invaluable for learning, since writing code, then compiling every time just seems to take away from my learning experience somehow.
Over the last few days, I've used Python a lot, but only as a desktop calculator. If you need more reasons to include a repl, I'd love to reduce my dependency on Python! :)
Also new to Dart
and find that Dart Pad https://dartpad.dartlang.org is nice _online_ REPL because we can share examples, but a Terminal REPL on localhost
is a _faster_ way to practice and build muscle memory in the programming language when _offline_. I use the REPL of other languages e.g. Elixir
(iex
), Node.js
(node
) or Ruby
(irb
) all the time!
It's a great way to _think_ in the programming language without needing files or a specific project.
Here here, I agree.
Although since posting my support, I haven't missed the feature much. I
think I was suffering from Pythonic Stockholm syndrome haha.
Take care,
Chris Norman
On Fri, 12 Jun 2020 at 16:02, Nelson notifications@github.com wrote:
Also new to Dartand find that Dart Pad https://dartpad.dartlang.org is
nice online REPL because we can share examples, but a Terminal REPL on
localhost is a faster way to practice and build muscle memory in the
programming language when offline. I use the REPL of other languages
e.g. Elixir (iex), Node.js (node) or Ruby (irb) all the time!
It's a great way to think in the programming language without needing
files or a specific project.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/dart-lang/sdk/issues/4409#issuecomment-643320740, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/ABBUZ2MOKZY3CFKGGWKS7CLRWI7Q3ANCNFSM4BO64HWQ
.
Most helpful comment
@matanlurey Could you please explain, why this is closed as obsolete?
As far as I can tell dart still hasn't a proper REPL.
I'm new to dart, so I'm sorry if I'm missing something obvious..