3 ms·
One language that allows for this is Dart. The only way to run code in another Thread is by spawning an `Isolate`. But once you have one, you can expose an API
by brabel 5y ago
One language that allows for this is Dart.
The only way to run code in another Thread is by spawning an `Isolate`. But once you have one, you can expose an API that is indistinguishable from an usual async one.
- pure_simplicity 5y agoCan you point me to any resource that talks more about this ?
- brabel 5y agoYou can check this post about Dart event loop and Isolates (which also has a video explaining it): https://medium.com/dartlang/dart-asynchronous-programming-isolates-and-event-loops-bffc3e296a6a https://medium.com/dartlang/dart-asynchronous-programming-is... And the Dart 2.15 announcement (latest version as of today), which had a focus on making Isolates fast: https://medium.com/dartlang/dart-2-15-7e7a598e508a https://medium.com/dartlang/dart-2-15-7e7a598e508a EDIT: the main article about concurrency in Dart is actually this one: https://dart.dev/guides/language/concurrency https://dart.dev/guides/language/concurrency
- ihateolives 5y agoDart in general has made many sensible choices, it's a nice language to work with. I recently decided to give it a try and I had literally zero friction coming from Java background. I'm rewriting some of my tools with Dart now instead of current mishmash of scripts.
- 0x445442 5y agoYes I recently started programming with Dart and I find it incredible how little buzz there is around it. I’m using it for writing small scripts right now and it’s been so refreshing to not run into one road block. The installation process is simple, documentation is excellent, the core library makes sense, the defacto package repository and package management is clean. And WRT this thread, the async model is dead simple to pick up. As a scripting language it seems to be a perfect fit. But there is also a lot of first rate tooling available for Dart and I am starting to wonder if it wouldn’t be a good choice for larger projects as well.
- brabel 5y agoI also come from a Java background and I really like that Dart can run as a script (like JavaScript) but it can also compile to a native executable (and unlike GraalVM, it compiles in a couple of seconds, not minutes, and pretty much any Dart code will work - no issues like Java has with reflection, for example). Try `dart compile exe app.dart` and then run `./app.exe`... it's really fast and the binary is fairly small!