TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Learning Rust with Entirely Too Many Linked Lists

56 pointsby xwvvvvwxover 7 years ago

5 comments

Animatsover 7 years ago
Rust needs back pointers as a primitive. A back pointer and a forward pointer are locked in an invariant relationship (A points to B which points back to A). The borrow checker needs to know about that to check back pointers properly. Then you could do trees, doubly-linked lists, and various other graphs safely.<p>(The two basic constructs that are hard to express safely in Rust are back pointers and partially initialized arrays. There&#x27;s also some trouble with concurrency primitives. See [1])<p>[1] <a href="https:&#x2F;&#x2F;people.mpi-sws.org&#x2F;~dreyer&#x2F;papers&#x2F;rustbelt&#x2F;paper.pdf" rel="nofollow">https:&#x2F;&#x2F;people.mpi-sws.org&#x2F;~dreyer&#x2F;papers&#x2F;rustbelt&#x2F;paper.pdf</a>
评论 #15383088 未加载
gradschoolover 7 years ago
An old school c programmer wants to know if there&#x27;s a Rust idiom for recovering gracefully from failed allocations (i.e., when malloc returns NULL). Otherwise, what good is a type safe program that crashes due to a heap overflow? If this is the wrong kind of question, I&#x27;m listening.
评论 #15381766 未加载
评论 #15380216 未加载
评论 #15381536 未加载
评论 #15382468 未加载
emergedover 7 years ago
I feel that Rust is something of a religion at this point. Curious how many downvotes I might accrue for expressing that perspective. Might be wrong, but my sense has been that challenges with Rust are written off in an off-hand way and its features exaggerated.<p>Glad to see promising new languages pushing progress forward, though. I&#x27;m head high in C&#x2F;C++&#x2F;asm for decades so many of the complaints about those languages fall flat with me since I&#x27;m over the hurdles via sheer years of experience.
评论 #15381826 未加载
评论 #15382552 未加载
评论 #15381846 未加载
评论 #15382066 未加载
derefrover 7 years ago
Question: does a hash table with linked-list chaining count as a non-niche use-case for linked lists, or is the linked list just counted as an implementation detail rather than a separate data structure in that context?<p>(Though, Rust&#x27;s own std::collections::HashMap just does robin-hood hashing instead of separate chaining, and everyone&#x27;s just going to use that, so &quot;what data structure should a separately-chained hash-table use in Rust&quot; is mostly a moot question.)
PaulHouleover 7 years ago
Makes Rust look hard.
评论 #15380219 未加载