[HN Gopher] REPL for Dart: supporting 3rd party packages, hot re...
       ___________________________________________________________________
        
       REPL for Dart: supporting 3rd party packages, hot reload, and full
       grammar
        
       Author : tosh
       Score  : 61 points
       Date   : 2024-09-28 16:33 UTC (6 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | daft_pink wrote:
       | I love repl and I hope more languages implement it.
        
       | aidos wrote:
       | 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 wrote:
         | 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 wrote:
           | from importlib import reload
           | 
           | Reload paired with inotify are the building blocks, to wire
           | up yourself.
        
           | aidos wrote:
           | Config file here with a couple of lines to add it to ipython
           | automatically.
           | 
           | https://github.com/aidos/dotfiles/blob/master/_config/ipytho.
           | ..
        
       | mdhb wrote:
       | 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 wrote:
         | 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 wrote:
           | 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 wrote:
         | 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 wrote:
           | 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 wrote:
             | Well, sure, but web.dart is one of the original packages
             | that came with Dart. That part isn't new.
        
               | mhoad wrote:
               | 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 wrote:
               | 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 wrote:
         | > It's a very bright looking future for it.
         | 
         | Err... At Google? After laying off the core maintainers? Not
         | bright at all.
        
           | mdhb wrote:
           | That literally never happened.
        
             | meiraleal wrote:
             | https://www.reddit.com/r/FlutterDev/comments/1cduhra/more_l
             | a...
        
               | skybrian wrote:
               | 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/comm
               | ent...
        
       | meiraleal wrote:
       | 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 wrote:
         | No the Flutter team wasn't laid off.
        
           | meiraleal wrote:
           | Yes, it was, from the horse's mouth: https://www.reddit.com/r
           | /FlutterDev/comments/1cduhra/more_la...
        
             | mdhb wrote:
             | 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.
        
             | IshKebab wrote:
             | https://x.com/MiSvTh/status/1785767966815985893
        
       | synergy20 wrote:
       | 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?
        
         | synergy20 wrote:
         | https://dart.dev/interop/js-interop
        
         | mhoad wrote:
         | They dropped that "client side" framing a while back
         | thankfully. It's considered a general purpose language at this
         | point.
        
       | masijo wrote:
       | Not strictly related (because it doesn't have a working REPL yet)
       | but may also find ClojureDart of interest.
       | 
       | https://github.com/Tensegritics/ClojureDart
        
       ___________________________________________________________________
       (page generated 2024-09-28 23:00 UTC)