REPL for Dart

89 pointsposted 15 hours ago
by tosh

35 Comments

0x_rs

4 hours ago

Dart is really nice to write in, with far less mental overhead than some of its would-be competitors that couldn't possess the same wisdom and foresight at the time of their creation, so an interactive shell for it is pretty cool. In general I think it's slowly trying to carve its place in the world other than Flutter's language (for which many great packages have been made), but it doesn't have any other forefront project or library, and probably still carries a bit of prejudice from the Dartium mayhem and being a language looking for some purpose that could be orphaned by a blind-sighted Google at any time, the Ads story about it still comes up often. I'd like to see it around more.

aidos

13 hours ago

Even though I don’t use Dart myself I very much approve of this initiative.

I live in my Python REPL (ipython) and I couldn’t live without my hot reloading without losing state. Allows for hacking about a bit directly in the REPL. Once something starts to take shape you can push it into a file, import it into your REPL then hack about with it in a text editor.

The hot reloading is great when you have a load of state in classes and you can change code in the editor and have that immediately updated on your existing objects in the REPL.

dbtc

11 hours ago

After learning how to do this in lisp I've been missing it in python. Do you use anything alongside ipython to make this happen?

mixmastamyk

10 hours ago

  from importlib import reload 
Reload paired with inotify are the building blocks, to wire up yourself.

mdhb

12 hours ago

There is so much cool stuff at various stages of landing in the Dart pipeline at the moment. A few things that come to mind include:

1. Dart now supports the native Web platform APIs and offers a really compelling alternative to TypeScript now thanks to their their latest generation of JS interop. Example for how the code looks here: https://github.com/kevmoo/kevmoo.com/blob/main/web/main.dart

2. Compile to WASM now on the web also with future work to also align itself with the emerging WASI standards both as a compile target and the ability to embed WASI runtimes into Dart programs (technically already possible through their C interop)

3. Lots of great work on cross language interop with C, C++, Swift, Rust, Go, JavaScript, Objective C, Kotlin and Java here https://github.com/dart-lang/native

4. Upcoming Macros feature which gives fully static type safe automatic and fully debugable code generation.

5. Potentially looking at bringing Shared Memory Multithreading to the language https://github.com/dart-lang/language/blob/2662d252b7fa93175...

6. Also some early work on a bytecode compiler it seems but I’ve not seen any kind of announcement about it here https://github.com/dart-lang/sdk/tree/main/pkg/dart2bytecode

7. This REPL

It’s really a good time to be a part of the community. It’s a very bright looking future for it.

BrutalCoding

12 hours ago

I wasn't aware of that bytecode compiler, even though I work with Flutter/Dart on a daily basis. How did you find out?

Nonetheless, that’s some low level stuff that I have little experience with haha.

mdhb

12 hours ago

I spend some time each week just browsing the various repos under the Dart account to see what’s going on in the ecosystem and that turned up recently but as I said there no kind of announcement so I would take them very literally when they say it’s an experiment.

skybrian

10 hours ago

Where is JS Interop used in the first example? (It's a bit hard to tell with the wildcard imports how much of that is actually coming from web.dart.)

mdhb

10 hours ago

Web.dart is basically designed to give you the equivalent of any of the browser based APIs you would find on MDN essentially unchanged so things like document.querySelectorAll and things like that would just work as though you were using JavaScript (and you technically are in the background) but without otherwise needing to ever leave Dart.

skybrian

10 hours ago

Well, sure, but web.dart is one of the original packages that came with Dart. That part isn't new.

mhoad

10 hours ago

That’s not actually correct I don’t know where you got that from. This is from this year and was built on top of a wider rewrite of their JS interop using new language features to make it essentially a zero cost abstraction.

Dart has had browser support and DOM APIs before but never had the same APIs you have in the web platform before.

skybrian

9 hours ago

I think I had it confused with dart:html, which looks almost the same. I don't see a big difference in the example code.

meiraleal

10 hours ago

> It’s a very bright looking future for it.

Err... At Google? After laying off the core maintainers? Not bright at all.

mdhb

10 hours ago

That literally never happened.

meiraleal

10 hours ago

skybrian

10 hours ago

Yes, there were layoffs. But "core maintainers" is not a term they use, and kind of fuzzy since people come and go; some early team members left well before then. People didn't all leave (or get laid off) at the same time, and they never laid off the entire team as far as I know.

More:

https://www.reddit.com/r/FlutterDev/comments/1cduhra/comment...

dartos

5 hours ago

Sure, whatever.

The one major company backing a project lays off a number of the team working on the project.

That is not exactly the signal of a bright future.

mhoad

an hour ago

It would be cool if you could apply even the most basic reading comprehension here where it says there was zero change in team size and stop spreading nonsense.

synergy20

11 hours ago

dart's syntax is very easy to pick up, sadly it's defined as a 'client-side language', instead of a general purpose one, otherwise I would invest more time into it.

while flutter is cross platform I think for the web, WASM is its focus, which I dislike, not sure what JS interop mentioned in the comment here really does. can Dart be compiled to readable JS?

mhoad

10 hours ago

They dropped that “client side” framing a while back thankfully. It’s considered a general purpose language at this point.

isoos

3 minutes ago

One of the postgresql client packages (posgres) is roughly 8 years old. That's how "client side" it ever was...

daft_pink

14 hours ago

I love repl and I hope more languages implement it.

meiraleal

11 hours ago

Didn't Google laid off the flutter team just recently? What sane person would use Dart after that? Almost nobody was using it even before anyway.

Dart, Kotlin, Go. I guess just one of them will survive if any.

IshKebab

10 hours ago

No the Flutter team wasn't laid off.

meiraleal

10 hours ago

mdhb

10 hours ago

I just want to make it clear that for all the bullshit on this topic as far as I’m aware it was a SINGLE PERSON and this weird story developed around it but the story you seem to have in your heard is completely wrong.

meiraleal

4 hours ago

Not sure why you are triggered by this (do you work on Flutter?) but this "weird" story is backed by https://killedbygoogle.com/ - we are not talking about a company without a track record here. Peace out.

mdhb

17 minutes ago

I just can not for the life of me understand the mentality of someone who themselves knows full well this isn’t a topic they are an expert in will jump into the middle of a conversation about it, spout nonsense and when they are corrected that what they are saying isn’t actually true chooses to double down on it rather than just accepting they had some bad information.

It’s just incredibly weird behaviour and yet, almost every time I’ve seen a conversation about Dart or Flutter on here for the past year or two I keep running into the EXACT SAME situation and made up stories like what you did today.