Hacker News new | ask | show | jobs
by ZeroCool2u 1530 days ago
Some fair points here. The differences that I've experienced have generally seemed very positive and it feels like significantly less boilerplate than Java.

As for Tony Hoare's billion dollar mistake, I'm not sure if you've seen the information about Sound Null-Safety[1], but it's actually one of my favorite features about the language. Static analysis in Dart feels a little bit like Rust in that as you write code your IDE can provide smart suggestions and bugs are often found as you write instead of when you compile.

Finally, I'll take the pub.dev[2] toolchain and build system over anything out there today besides Cargo. Plus, compiling to a single executable file without any dependencies that have to be installed on the deployment target is great.

  "There are many better Java++ languages out there."

Any in particular you'd suggest? I'd definitely give it a shot if it blows Dart out of the water!

[1]: https://dart.dev/null-safety

[2]: https://pub.dev/

1 comments

Ok, it looks like they've now retrofitted null safety, but why wasn't it designed in from the start? I can't help but feel this was always a Java-clone to avoid litigation, not any kind of innovative project.

Kotlin looks like a good Java++ language (especially for Android); and Typescript would be the most pragmatic choice for web. But again, Dart is going to have to keep up even with modern Java.

Regarding boilerplate, can Dart define a simple data class with equals and hashcode in one or two lines?

I think you'll find that in many ways that today's Dart is very different from the earlier iterations people experienced in 1.x. You're right it wasn't designed in from the start, but I couldn't possibly say why. I can say it doesn't feel bolted on and it's definitely the default for all Dart code I've seen recently in the wild. Kotlin is certainly nice to write in, but all else being equal, if I can avoid the JVM and get easy AOT compilation, deployment, and distribution I'll take that every time. Typescript transpiles to JS, same as Dart, so that just seems like extra steps, but there are clearly advantages to sticking with regular JS frameworks over Flutter for the moment, so I won't argue that point. I'm really just talking about Dart here.

Frankly, I haven't needed to implement such a basic data structure myself in Dart, but here's a whole book of examples of implementing common data structures[1]. They look pretty straight forward to me. You can also take a look at the Dart language tour.[2]

[1]: https://www.raywenderlich.com/books/data-structures-algorith...

[2]: https://dart.dev/guides/language/language-tour