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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

The road to Dart 3: A fully sound, null safe language

108 点作者 markdog12超过 2 年前

17 条评论

johnthuss超过 2 年前
&quot;For Dart, we chose the path of sound null safety.&quot;<p>Null Safety is the killer feature of modern programming languages like Swift and Kotlin. It provides a clarity you just can&#x27;t get otherwise and saves you from runtime errors. And it requires very little additional ceremony to use.
评论 #33909571 未加载
评论 #33916461 未加载
评论 #33912885 未加载
评论 #33910409 未加载
alefnula超过 2 年前
I&#x27;m surprised that no one is commenting on macros. For me, that is the most exciting feature! It&#x27;ll make writing code so much more enjoyable and avoid all of the code generation happening at the moment.<p>But maybe I&#x27;m the only one who&#x27;s bothered with code generation :D
评论 #33910305 未加载
latchkey超过 2 年前
I&#x27;d love to see Dart break out of just being the language for Flutter. I built an app in Flutter and Dart was quite fun to learn and work with. Will it ever break out of its shell?
评论 #33910488 未加载
评论 #33909611 未加载
评论 #33910570 未加载
nu11ptr超过 2 年前
I love the idea of sound null checks, but doesn&#x27;t Dart also have unchecked exceptions? To me it seems a bit weird to focus so heavily on type soundness when at any moment a piece of code could throw an unexpected exception that kills your program. I realize these are very different features, but a language is more than the sum of its parts. While I realize every language has some level of unchecked exceptions out of necessity (ie. panics on divide by zero, etc.), they are not meant as general level error checking, but as more of a &quot;can&#x27;t continue - things are that bad&quot; kind of mechanism.<p>In summary, if they are that convinced sound null types are needed, to me it needs better error handling that matches the same level of discipline. That said, any and all improvements are always welcome, so I do think overall it is cool they are taking this seriously.
评论 #33911254 未加载
评论 #33909975 未加载
评论 #33909856 未加载
评论 #33909620 未加载
account-5超过 2 年前
I&#x27;m glad to see this here, I like Dart. HN in general doesn&#x27;t seem to. IMO for cross platform development Dart is the way to go if you are wanting a single code base and targeting desktop&#x2F;mobile&#x2F;web. Some of the things this language can do is amazing.<p>For quick scripts I still reach for python or Linux: bash, Windows: AHK. But if I&#x27;m developing an app I now reach for Dart&#x2F;Flutter.
评论 #33910278 未加载
评论 #33910331 未加载
评论 #33910567 未加载
评论 #33911109 未加载
评论 #33910716 未加载
评论 #33912088 未加载
评论 #33910317 未加载
dom96超过 2 年前
Dart is one of those languages that has always felt obscure to me, even though there appears to be a lot of work put into it. What are folks using it for?
评论 #33908265 未加载
评论 #33909070 未加载
评论 #33909172 未加载
评论 #33909050 未加载
truth_seeker超过 2 年前
Pattern Matching looks good too !<p><a href="https:&#x2F;&#x2F;github.com&#x2F;dart-lang&#x2F;language&#x2F;blob&#x2F;master&#x2F;accepted&#x2F;future-releases&#x2F;0546-patterns&#x2F;feature-specification.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dart-lang&#x2F;language&#x2F;blob&#x2F;master&#x2F;accepted&#x2F;f...</a>
999900000999超过 2 年前
Flutter web + Firebase allowed me to create a small web app fairly quickly. Hosted effectively for free so it&#x27;s been deploy and forget.<p>Dart is a pleasure to work with, I&#x27;m not really a CS guy, but it&#x27;s like Typescript with real types. Better tooling, no NodeJS legacy crap barely holding itself together.<p>I don&#x27;t know if it&#x27;ll ever unseat React on the Web though. Once an ecosystem has momentum it&#x27;s hard to disrupt.
pizlonator超过 2 年前
I don’t buy that null is a billion dollar mistake.<p>Just because some dude with a fancy name said so doesn’t mean it’s true.<p>In particular, how many dollars does it cost to have null safety, and how many more does it cost to use it? I feel like folks quoting Hoare never even bother asking this question.
评论 #33908913 未加载
评论 #33909235 未加载
评论 #33909700 未加载
评论 #33908843 未加载
评论 #33908780 未加载
评论 #33908949 未加载
评论 #33909126 未加载
评论 #33908948 未加载
评论 #33908996 未加载
评论 #33908814 未加载
评论 #33909206 未加载
评论 #33910175 未加载
评论 #33909932 未加载
评论 #33908816 未加载
评论 #33908893 未加载
Alifatisk超过 2 年前
I enjoy Dart a lot currently, but I can only imagine it being used on the client-side for building an ui, nothing else. It even advertises itself like so.<p>To me (with my limited knowledge on Dart), it feels like Dart is lacking a lot if it wants to work as a systems language.
评论 #33915845 未加载
geyforkotlin超过 2 年前
When I first got into Kotlin I thought that null safety was a matter of getting rid of null, like some try to do in their Java code.<p>Now I know that actually it gives me liberty to safely use null wherever I want and not have to worry about it blowing up in my face later.<p>The keys to this is that the language makes it obvious what can be null &quot;Type?&quot; and by giving me ergonomic tools to handle nulls such as ? and :? and compiler non-null inference. I wonder how this pattern of<p>make X visible and give ergonomic tools to handle X<p>could be applied to improve other aspects of programming.
ljw1001超过 2 年前
What is the state of dart for cross-platform development? I looked a few years ago and it seemed like progress was being made for web development and desktop use, if I remember correctly.
评论 #33908674 未加载
评论 #33909111 未加载
评论 #33908955 未加载
jgavris超过 2 年前
I&#x27;m genuinely curious, and I don&#x27;t know much about Dart and haven&#x27;t used it. The comparisons to Kotlin are interesting, especially sealed classes and pattern matching. For this example from the post, is it not possible use an extension method (common practice in Kotlin I&#x27;ve seen and written)?<p>double calculateArea(Shape shape) =&gt; switch (shape) { Square(length: var l) =&gt; l * l, Circle(radius: var r) =&gt; math.pi * r * r };<p>Aka:<p>extension Area on Shape { double calculateArea() { ... } }
评论 #33914771 未加载
hajile超过 2 年前
These sound like amazing advancements. Now they just need to add a builtin Option&lt;T&gt; to all the things.
评论 #33915024 未加载
frou_dh超过 2 年前
It seems there&#x27;s often a need for languages to evolve towards sanity rather than being sane out of the gate.
评论 #33909122 未加载
revskill超过 2 年前
A language without null safety in the design in first place isn&#x27;t worth my time at all. It&#x27;s like a &quot;business language&quot; , released with deadline. I&#x27;ve suffered enough burnout and stress for those kinds of languages already. It&#x27;s enough.
jmyeet超过 2 年前
Some claim null is a mistake. I will counter and say that null not being exportable within the type system was the real big mistake.<p>Languages where you can express if something can be null or not are a joy to work with and remove a whole class of errors.<p>That being said, I still don’t really understand the value proposition for Dart. Through different versions it’s morphed in the classic solution-looking-for-a-problem way (eg the optional typing). Did we really need this when Java, JavaScript, Python and Go existed?