5 ms·
How come? What's so bad about dart?
by account-5 4y ago
How come? What's so bad about dart?
- virtualwhys 4y agoOff the top of my head, no access modifiers (so private variables, for example, are prefixed with `_`, by convention, not enforced by the compiler), no pattern matching (and obviously no exhaustive matching), no record types, no sum types, no json (de)serialization (requires 3rd party libary code gen, wow), mutability everywhere, everything is a statement (i.e. no implicit `return`, AKA everything is an expression), required semi-colons (which they'd like to get rid of but can't due to questionable design decisions made long ago -- for the gory details see here[1]). If you like Java 8 and earlier you'll probably feel at home with Dart. Obviously I'm biased, but I find Dart to be one of the most unpleasant languages I've had the misfortune of being exposed to; this despite Flutter and its instantaneous hot code reloading being quite amazing -- a bizarre mix of promise and despair. [1] https://github.com/dart-lang/language/blob/master/resources/optional-semicolons-prototype.md https://github.com/dart-lang/language/blob/master/resources/...
- kennytilton 4y agoAs a Dart/Flutter outsider myself, I am finding all this "Dart no, Flutter yes" traffic intriguing. I am also a lisper, so no need to sell me on the difficulties of Dart, even if it were the perfect static typed OO, but it sounds like we have a great UI stuck inside an unloved language. Happy opportunity for ClojureDart! btw, in case anyone is wondering, I am not a part of Team CLJD at all. My hack is my own separate effort.
- pjmlp 4y agoEasy, its only purpose to exist is for doing Flutter apps, there is hardly any significat use of Dart outside of Flutter.
- TobyTheDog123 4y agoThat's in no way a bad thing, some may say that means it does one thing (an important thing) extremely well ;) I switched from a purely TS/JS stack (React-Native-Web to cover iOS/Android/Web, Typescript on the backend, with some stuff to share types), and just got way too tired of all the tooling, the configuration, etc. While I use Golang on the backend (compiled to WASM for serverless) I wouldn't be against using Dart on the backend if it had a WASM compiler... ....and upon doing some research to put a link in here, apparently you can as of seven days ago? https://github.com/dart-lang/sdk/blob/main/pkg/dart2wasm/dart2wasm.md https://github.com/dart-lang/sdk/blob/main/pkg/dart2wasm/dar...
- tjpnz 4y agoIt does predate Flutter by five or so years but I do agree that it doesn't have much of a reason to exist outside of that now. I would love to have been a fly on the wall when the decision was made to choose Dart.
- fakedang 4y agoDidn't it have something to do with Dart being pushed as Google's pet language? I have heard arguments that it was chosen because TS is Microsoft's pet, while Oracle was having a picnic with Java (this was around the time of the Google-Oracle saga). Dart was seen as a way for Google to be independent of both, and Kotlin wasn't developed yet at the time, hence Flutter went with Dart.
- pjmlp 4y agoIt is a bit more convulated than that. Dart was being pushed as JavaScript replacement, back when everyone had one. However Chrome team failed to push ChromiumVM and eventually the project was ramped down, by then AdWords had made a massive investment moving from GWT into AngularDart, so they rescued the project. Eventually Flutter, initally prototyped in JavaScript, moved into Dart, and they also decided to change the language semantics from dynamic language with gradual typing (Dart 1.x), to static typing with type inference (Dart 2.0). Somewhere alongside this timeline, many well known names from language design like Gilad Bracha and Kasper Lund, well known for favouring dynamic languages, left the project. Kasper Lund's latest project, is not surprising also a dynamic language, https://toit.io/ https://toit.io/
- dr_kiszonka 4y agoDo you know what is the relationship between Dart/Flutter and Kotlin? On paper, it seems that Dart/Flutter is a better choice in the context of mobile dev because it is cross platform. If I were to focus on Android exclusively, would Kotlin offer any advantages over Dart/Flutter? I guess I am trying to understand why these two coexist, which one to learn, and how likely it is that Google will kill Dart/Flutter in the next 5-10 years.
- hardwaresofton 4y agoThe last time I used Dart, it felt like the worst parts of C# + Java put together somehow. The type system was verbose yet relatively weak in comparison to something like Typescript, it'd already been rewritten once (which isn't a bad thing), and it was almost unusable outside the platform (I remember trying to write tests for something using sqlite.dart and then realizing that you just... couldn't). Flutter is an amazing technical achievement, and to some extent so is Dart (there's a great talk from strangeloop about it) but I just... want to be able to use anything but Dart in there. Being able to use Typescript with Flutter would be heaven (JS compatibility was something in early versions of Dart that was removed).
- kennytilton 4y agoI think you have made the case for ClojureDart. Clojure does not do the Typescript strong typing thing, but it meets the "Not Dart" requirement pretty well. And my specific contrib, Matrix, handles state management and the whole reactive thing pretty well, one area where I see a bit of thrashing in the Flutter community. Check out the examples and esp. the TodoMVC demo, they cover quite a bit of ground.
- satvikpendem 4y agoDart is at least adding new features relatively quickly (just recently they started working on immutable record data structures with pattern matching, which even TypeScript doesn't have yet) and soon they'll have static metaprogramming meaning you can have Lisp like macros to create your own syntax, including algebraic data types as in any functional language. That is really what people are looking forward to. Another thing is Dart is JITed, AOT compiled as well as compiling to JS and WASM. Very few languages can do all 4. JVM ones can't, so no Kotlin (we'll see how well Kotlin Native works), and V8 isn't AOT so no JS or TS either. Only alternative I can think of is Lua.
- kaba0 4y agoIt is easy to iterate fast on language design when you don’t care about backwards compatibility. > Very few languages can do all 4. JVM ones can't Java can (JIT is trivial, for AOT there is among others Graal, for JS and WASM there is TeaVM (which works on class files, so now that I think about it, pretty much every JVM language can do all platforms), but also the very great Closure compiler (j2cl) which has no relation to cloJure, made and used heavily by google)