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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: Bolt: A research language with finer-grained concurrency than Rust

103 点作者 mrathi12大约 5 年前

2 条评论

comex大约 5 年前
So the features that the dissertation claims Rust doesn’t have are:<p>- Single-threaded mutable aliasing<p>Actually, Rust supports this in the form of the `Cell` type. It’s admittedly not very ergonomic, though. Also, Bolt runs on the JVM and thus has a garbage collector. This pattern is more powerful in a garbage-collected environment, because merely reading a pointer is enough to guarantee it won’t be collected. Suppose you (1) read a mutable field of type string, (2) call some other code that might write a different string to that field, then (3) access the string you originally read. With garbage collection, this is safe; without it, your string might have been freed by the time you access it. You can also make this safe with reference counting – most interpreted languages do this, Swift does it with class fields, and there are libraries to do it in Rust – but fiddling with reference counts every time you access an object is fairly slow.<p>&gt; Concurrently mutate disjoint parts of object<p>Out of the box, Rust lets you take mutable references to disjoint parts of an object and send them to different places, including different threads. Bolt also apparently lets you pass these around as linear capabilities; translated to Rust terms, it’s like if you could take a Box&lt;(Foo, Bar)&gt; and split it into a Box&lt;Foo&gt; and Box&lt;Bar&gt;. Rust doesn’t support this out of the box, but you can get something equivalent with the owning_ref crate (again, a bit less ergonomic, but still safe).<p>&gt; Concurrently mutate object, locking overlapping state<p>You can easily do this in Rust with Arc&lt;Mutex&lt;Foo&gt;&gt;. Bolt apparently inserts mutexes automagically where needed, but other than that I don’t see any ergonomic difference. Most Rust programmers would probably not appreciate mutexes being inserted automatically; locking is expensive and creates the possibility of deadlocks, so for both a performance and correctness standpoint you want to understand where mutexes are being used.
评论 #23131875 未加载
评论 #23130327 未加载
评论 #23131308 未加载
评论 #23130852 未加载
评论 #23130660 未加载
评论 #23133198 未加载
TheAsprngHacker大约 5 年前
Discussion on r&#x2F;ProgrammingLanguages: <a href="https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;ProgrammingLanguages&#x2F;comments&#x2F;gg0cmd&#x2F;bolt_a_new_language_with_datarace_freedom&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;ProgrammingLanguages&#x2F;comments&#x2F;gg0cm...</a>