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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Pony: Lock-less, data-race-free concurrency

13 点作者 whynotwhynot将近 5 年前

1 comment

whynotwhynot将近 5 年前
&quot; - It’s type safe. Really type safe. There’s a mathematical proof and everything.<p>- It’s memory safe. Ok, this comes with type safe, but it’s still interesting. There are no dangling pointers, no buffer overruns, heck, the language doesn’t even have the concept of null!<p>- It’s exception safe. There are no runtime exceptions. All exceptions have defined semantics, and they are always handled.<p>- It’s data-race free. Pony doesn’t have locks or atomic operations or anything like that. Instead, the type system ensures at compile time that your concurrent program can never have data races. So you can write highly concurrent code and never get it wrong.<p>- It’s deadlock free. This one is easy, because Pony has no locks at all! So they definitely don’t deadlock, because they don’t exist.<p>&quot;<p>&quot;By sharing only immutable data and exchanging only isolated data we can have safe concurrent programs without locks. The problem is that it’s very difficult to do that correctly. If you accidentally hang on to a reference to some isolated data you’ve handed over or change something you’ve shared as immutable then everything goes wrong. What you need is for the compiler to force you to live up to your promises. Pony reference capabilities allow the compiler to do just that.&quot;<p>&quot;Reference capabilities allow you to label different bits of data based on how that data can be shared. The Pony compiler will then verify that you are in fact correctly using the data based on the labels you provide. Reference capabilities combined with Pony’s actor model of concurrency makes for a powerful pairing.&quot;<p><a href="https:&#x2F;&#x2F;www.ponylang.io&#x2F;discover&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.ponylang.io&#x2F;discover&#x2F;</a>