Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Dart: Sound Null Safety (medium.com/dartlang)
33 points by markdog12 on June 10, 2020 | hide | past | favorite | 15 comments


I've been using Dart and Flutter recently, mostly happy with it, Dart got into my top 3 languages actually (the other 2 are Swift and Julia).

Some random thoughts about Dart:

- The design seems driven by pragmatism and developer experience. I hate dogmatic approaches to languages (such as: FP is always better than OOP).

- No REPL.

- Two things I like about doc comments. First, they use "///" instead of "/* */". Second, instead of the Javadoc style where every method argument and the return value must be described, in Dart the preferred style is to describe the method naturally with no prescribed structure.

- The formatter defaults to 80 characters, I think something like 105 would be better.

- Don't like the access control model where private members start with an underscore, it's just ugly. It would be better if everything was private by default and public memebers would be annotated with the "public" keyword.

- Overall, it seems like poor man's Swift, can't think of any amazing feature right now, but the whole experience is good, not too far behind Swift, better than Kotlin, even though Kotlin should be better on paper.

And Flutter:

- It's fun and easy compared to Android and iOS. (I haven't tried Swift UI yet so can't compare.)

- Iteration speed is amazing and a killer feature. I have the IDE and the iPhone simulator side by side and with Cmd + \ I can reload the app in like half a second.

- You can't achieve truly native experience but you can get close. The widgets don't accurately mimic native widgets. For example scrolling physics on Android - it's just similar.

- Performance seems reasonably good, native apps just feel a bit better for me.

- Flutter is the best technology for multiplatform mobile development IMO, unless you want to share code with web - Flutter for the web is DAO.


> Overall, it seems like poor man's Swift, can't think of any amazing feature right now, but the whole experience is good, not too far behind Swift, better than Kotlin, even though Kotlin is more feature-packed.

It's actually the reverse. Dart was designed before Swift and Swift seems to have taken quite a few ideas from it. The "big" difference to me is tuples, but Dart has the idea open under multi-value returns. Another big difference is GC vs reference counting, but I think the GC is the correct choice.

I rather like the underscore for private variables. It helps remind me without having to reference the top of the file constantly.


Which ideas did Swift take from Dart?


I didn't like the underscores for private variables at first, but it kinda grows on you. Visually they really stand out when reading code, which is a good thing.


> better than Kotlin

I haven't used Kotlin in any significant capacity, but what does Dart do better than it?


Dart is simpler and more regular. Kotlin's couroutines feel much more complex and mentally taxing than Dart's implementation.


Wow, they really listen to people's feedback. Looking forward to testing it with a couple of small apps I have once it becomes stable. Overall, the dart/flutter experience has been amazing for me. The team looks serious about providing the absolute best developer experience and so far they've done it.

Flutter's future looks promising because it's also a first-class citizen in the new Fuchsia OS. I don't know how's that experiment gonna end up, but even today it can be considered one of the best UI toolkit we have.


Kudos to the Dart team. I'm sure this feature was a super heavy lift.

"The soundness of Dart’s null safety has another welcome implication: it means your programs can be smaller and faster. "


What is Dart being used for these days? This isn’t snark I’m curious. I looked into it a couple years ago but ended up going with TS for a project, it looked pretty neat though.


Dart is used by https://flutter.dev/ a Google UI toolkit

Flutter's focus has been mobile apps, but they are working web and desktop.

Dart pad has some flutter demos https://dartpad.dev/


Is it used for anything other than Flutter? I remember they initially pitched Dart as a wholesale replacement for JavaScript on the web, before Flutter even existed.



Yeah, couple of server side projects... Curious: what was the deciding factor back then? Did it changed now?


I'll never understand why people thought it was a good idea to design static type systems that can't express nullability/non-nullability in the first place. In a Java codebase every single object reference is a potential land-mine, and the only way to be totally safe is to add a null check before every single access or method call. So most people just roll the dice until something inevitably breaks.


> Dart shares sound null safety with Swift, but not very many other programming languages.

What about Kotlin and Rust?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: