TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Understanding null safety in Dart

96 点作者 timsneath将近 5 年前

9 条评论

yagodragon将近 5 年前
I believe Dart is a more exciting language than Go. It&#x27;s the most well designed scripting language out there, that can also be AOT compiled into native binaries. It&#x27;s a better JS and a better Java at the same time. It would be also a killer language for backends and simple websites. Just imagine a better node.js built around Dart&#x27;s excellent tooling.<p>What made Go more successful than Dart was a mix of decisions, luck, and momentum. On an alternate reality, Dart would swap places with Go. Dartium VM would have replaced Javascript on the Web and everyone would have been happy. Go would be seen as an obscure language with missing features that doesn&#x27;t really do anything better than java&#x2F;C#&#x2F;C++
评论 #23953051 未加载
评论 #23953744 未加载
评论 #23953151 未加载
评论 #23953427 未加载
评论 #23953431 未加载
jitl将近 5 年前
Does Dart2 offer any compelling features as a language that aren’t also present in Kotlin, Typescript, Swift, or Haxe? I know many users are interested in Flutter - but I’m curious more about the language itself. Whenever I see Flutter examples I’m disappointed I can’t use it with Kotlin (which already has many specialized backends) or some other language with more widespread support outside the Google ecosystem.
评论 #23951385 未加载
评论 #23951059 未加载
评论 #23951155 未加载
评论 #23951456 未加载
评论 #23953894 未加载
评论 #23952652 未加载
hardwaregeek将近 5 年前
Null safety is absolutely essential for me. It&#x27;s 2020, why are we still having NullPointerExceptions? However I&#x27;m curious about the next frontier of safety. We&#x27;ve slowly added a lot of nice features around safe use of values and safe memory. I wonder what&#x27;s next.<p>Personally I&#x27;ve been thinking about safe use of arrays. Arrays are such an important data structure and yet they&#x27;re horribly unsafe. Every time I do index math I get that same nervousness that I used to get accessing fields in nullable data structures. I&#x27;d love for a way to verify array indices that doesn&#x27;t involve too much dependent typing.
评论 #23951047 未加载
评论 #23951063 未加载
评论 #23950893 未加载
评论 #23951231 未加载
评论 #23950755 未加载
评论 #23950773 未加载
Abishek_Muthian将近 5 年前
Not a Dart programmer, but looking at it for flutter. I see from Jetbrains Developer Survey[1] that Dart has grown to 9% from 6% last year[2] which I think is because of flutter, which has grown its share to 39% in cross-platform development.<p>But doesn&#x27;t it seem reasonable to use TypeScript for flutter now? If you are not a Googler, Where do you use Dart (outside flutter) in production for a purpose where it is better than TypeScript?<p>[1]<a href="https:&#x2F;&#x2F;www.jetbrains.com&#x2F;lp&#x2F;devecosystem-2020&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.jetbrains.com&#x2F;lp&#x2F;devecosystem-2020&#x2F;</a><p>[2]<a href="https:&#x2F;&#x2F;www.jetbrains.com&#x2F;lp&#x2F;devecosystem-2019&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.jetbrains.com&#x2F;lp&#x2F;devecosystem-2019&#x2F;</a>
评论 #23953157 未加载
评论 #23952412 未加载
评论 #23953932 未加载
评论 #23953242 未加载
评论 #23953656 未加载
mindvirus将近 5 年前
I&#x27;m very happy about this - lack of null safety and implicit downcasts are two of the biggest problems with Dart&#x2F;Flutter, which I otherwise really enjoy working in. I&#x27;ve gotten in the habit of adding &quot;assert(x != null)&quot; in all of my methods.
评论 #23959725 未加载
skocznymroczny将近 5 年前
Dart is one of my favourite languages right now. I know it gets a lot of criticism for not reinventing the wheel and being heavily OOP based, but it&#x27;s simple enough, standard library works well, IDEs work great. Also it actually has some unique features which I now miss from other OOP languages, such as named constructors - new Angle.fromRadians(...), new Angle.fromDegrees(...) - feels much cleaner and more self-documenting than the static factory method other languages have you use.<p>Optional typing I never really cared about, because even in languages with var I find myself writing the types whenever possible.
chubot将近 5 年前
I used flow typing in MyPy and it&#x27;s awesome. TypeScript has the same thing (although I would be curious if their rules are significantly different).<p>I think you can&#x27;t practically have null safety without flow typing, at least in an imperative language, otherwise you end up with casts everywhere. MyPy has null safety, though it takes some effort to turn it on for most codebases.
评论 #23952901 未加载
评论 #23956728 未加载
ElliotH将近 5 年前
I&#x27;m really hoping this will make AngularDart a lot nicer to write. Inputs might have a null value and it&#x27;s very easy to forget to account for it, will be great to catch that at compile time.
olodus将近 5 年前
Looks to be very close to the solution Zig also went for. I like the solution and it seems to fit both languages very well. I should look a bit further into Dart some time I think.