News for hackers. Stuff that matters.
Re:Rust Starter Kit 2020 by lumost on Saturday October 03, 2020 @04:29PM (#24674467)
First off, thank you for all of the work you've put into Rust! I think the challenge that you face is that if the problem is CS101 courses, then Rust will always be unfamiliar to the majority of practicing professionals.

Cyclic/recursive datastructures are common in web services, where one needs to model bidirectional relationships ( just think of friends on a social graph ). As well as several primitive datastructures such as the O(1) LRU cache.

Checking the Rust docs out, a dev who encounters this problem for the first time will eventually need

- "Reference Cycles Can Leak Memory" https://doc.rust-lang.org/book/ch15-06-reference-cycles.html -- caveat: what if ownership is truly bidirectional?

- "unsafe" https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html

- 5 different primitive lists which don't tell you how to make a friends graph: https://rust-unofficial.github.io/too-many-lists/infinity-do...

- Someone elses attempt: https://rcoh.me/posts/rust-linked-list-basically-impossible/

- Careful reading of the LinkedList implementation to see that unsafe is probably the best approach: https://doc.rust-lang.org/beta/src/alloc/collections/linked_...

I'm a little biased on this front, when I first picked up Rust I chose to tackle an O(1) LRU cache as a quick learning exercise. I ended up beating my head against a wall for 20 hours. However on my current project I'm analyzing the wikipedia dataset ( another bidirectional structure ).

It would be useful to have a canonical/standard way to address such programming tasks other than "don't" - particulary if the way to address them is substantially different from what someone would have learned in a different language.

Re:Rust Starter Kit 2020 by steveklabnik on Saturday October 03, 2020 @04:36PM (#24674504)
You’re welcome!

Do you really think the majority of professionals have CS degrees? I’m not so sure. And beyond that, it would have to be “a majority with a degree” and “a majority that choose to implement data structures as an initial/early task.” I’m really not convinced the numbers actually play out that way.

Re:Rust Starter Kit 2020 by lumost on Saturday October 03, 2020 @04:50PM (#24674570)
Hmm playing off my own anecdote - I do not have a formal CS degree, but I ended up taking courses and reading a few of the typical books later on.

I think while my early experience biased me, the pain would have happened at one point or another eventually. I'd be surprised if the majority of web devs, and data science folks exploring rust wouldn't hit this problem at some point or another. As an example, one could easily run into this problem while writing an wiki,instagram, or twitter clone!

Re:Rust Starter Kit 2020 by steveklabnik on Saturday October 03, 2020 @05:39PM (#24674859)
Sounds like we're opposing anecdotes; I do have a CS degree, but didn't try to start with data structures.

You may want to use something with those characteristics, sure, but that doesn't mean most users start by trying to implement, rather than use something existing.