3 ms·
It feels wrong architecturally for Google to be pushing this right now: 1) Dart was intended as a Java like language and is inferior to Kotlin, a language they
by jillesvangurp 8y ago
It feels wrong architecturally for Google to be pushing this right now:
1) Dart was intended as a Java like language and is inferior to Kotlin, a language they just endorsed on Android yesterday. Dart feels like a step back, not forward. The message is confusing from Google on this front. They have a huge Kotlin developer community already. Why push Dart at all?
2) World + dog is moving towards compiling Kotlin and many other languages to web assembly as well as native. Cross compiling Dart to javascript was maybe a valid choice a few years ago but not in 2019. See e.g. Rust roadmap for this year, .Net 5.0 agenda for MS, Kotlin Native, etc.
3) LLVM seems to be the toolchain of choice for this type of stuff to happen. Go and Kotlin + WASM would be very valid choices for Google to prioritize on this platform.
4) In a browser you need to be driving the DOM to look and feel like a proper web application. If you abandon that notion, you might as well grab something like QT or some other UI toolkit and use that.
My recommendation would be for Google to untangle flutter from Dart and just retire that and focus on WASM and native based runtimes only. That's going to take time and in my view it's inevitable that whatever they are pushing right now is ultimately going to be deprecated in favor of something like that.
- edtechdev 8y agoDart was originally meant to be a superior alternative to JavaScript. They originally wanted native Dart support in the browser (dartium) just like there is native JavaScript support. Kotlin was/is meant to be a superior alternative to Java. Java != JavaScript Flutter I'd say is more like a successor to Flash. Dart is now relegated primarily to being Flutter's ActionScript.
- jillesvangurp 8y agoEither way, it feels like step back. Kotlin compiles quite nicely to javascript as well.
- munificent 8y agoIf you just look at the languages, Kotlin has a lot of nice features that Dart doesn't currently have. Non-nullable types, extension methods, and data classes are on the top of my mind. If you look at Kotlin and Dart as implementations, then there are differences under the hood. Kotlin is deeply married to the JVM. That has a lot of obvious pros: you can seamlessly interop with your existing Java code, reuse the existing JVM ecosystem, and incrementally migrate your code to Kotlin a file at a time. There are trade-offs to this, though. Kotlin fundamentally doesn't own its runtime. It gets the JVM for free, but anything the JVM lacks, it has little easy way to acquire. Dart is both its own language, and its own ecosystem and runtime. This means the adoption cost is higher, and our growth has been slower. We had to build more from scratch. But the return on investment is that we have a runtime that is deeply tuned for Dart and the needs of our users. For example: * Our garbage collector is tuned for the frequently-allocated but short-lived objects that get constructed every frame by a reactive framework. * When you deploy your app, we compile your Dart code ahead of time, all the way to machine code, statically link in the runtime, and give you a standalone native executable. Our deployment model is closer to C/C++ than to Java or C#. * Our runtime object representation faithfully understands the full language. For example, there's no type erasure, and generics are represented at runtime. You can ask a list if it's a List<int> or List<Object> at runtime and it will tell you true. * We can expose interesting debugging, profiling, and other diagnostic hooks from the runtime to tools. For example, the Flutter Inspector [0] will show you the bounding boxes of every widget on screen from the running app on your device. Touching one navigates your IDE to the corresponding source code. We can do that because we have the ability to plumb things all the way through the IDE, parser, compiler, runtime, and debugger, because it's all a custom stack. * Likewise, the near-instant hot reload stuff we do works because the language design, Flutter framework design, IDE integration, compiler, and runtime all work in concert to enable that. Even non-obvious things like the fact that static fields are lazily initialized in Dart make this stuff easier. Of course, the Kotlin+JVM advantages are real too. It's a question of which trade-offs are right for you today, and tomorrow. One thing I'm particularly excited about right now with Dart is that we're in a much better places to evolve the language quickly now that we've moved to 2.0, a full static type system, and a shared front end. Right now, we're implementing non-nullable types. Ours will be fully sound, unlike in Kotlin and TypeScript, because they have to handle values flowing in through interop. We're also implementing extension methods. I'm hoping we can do something a la data classes not too long after. If we pull that off, I hope users will feel that we're at parity at the language level and then it becomes more a question of which tools are the best ones for your need. [0]: https://flutter.dev/docs/development/tools/inspector https://flutter.dev/docs/development/tools/inspector
- jillesvangurp 8y agoActually Kotlin has a native compiler and (and a js compiler) and I'm not advertising the JVM variant here. The native compiler is also able to target WASM. WASM of course still lacks a garbage collector, which is currently holding back Kotlin (and other languages) there. I believe Google is involved in fixing that. On native they bundle their own garbage collector. I imagine MS is bundling one with Blazor in WASM. As soon as WASM matures (GC, threads, and a few other things) that becomes an obvious path for Flutter as well. Now would be a good time to start working on that. E.g. MS is doing very similar things with C# and Blazor as you are doing with flutter. Except they are doing this with WASM and llvm (check their .net 5.0 announcements a few days ago). I think this is the future proof path for Flutter as well and I question the need for Dart or a separate runtime. IMHO a LLVM based toolchain like on IOS needs to be the default on Android/ChromeOS as well. Something like Flutter paired with Kotlin or Swift could work really well. I've actually heard of flutter projects doing the business logic in Kotlin and cross compiling that as a library to IOS and Android. The main reason the team cited is that they thought Dart was simply to limited for what they needed; from their point of view it was a necessary evil. It's great that you are trying to fix that. IMHO Typescript and Kotlin are worlds apart (I use both). Typescript is much more limited and way more quirky to deal with.