News for hackers. Stuff that matters.
Re:Ask HN: What technologies did you learn in 2018? by amelius on Sunday December 23, 2018 @01:12PM (#18747427)
Have you tried writing a doubly linked list?

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

Re:Ask HN: What technologies did you learn in 2018? by marcosdumay on Sunday December 23, 2018 @06:19PM (#18749078)
In my experience, there are plenty of things that are much harder in Rust than other languages. Those tend to fall on the "how you do things", instead of the "what you want to achieve" side of work, so often it's just a matter of stopping, asking yourself "can't the language help me somehow instead of making my life harder?", and adapting your ways.

A few times you are not so lucky and have an actual need that Rust makes harder. Those exist, like in any other language, and I'd be happy if I knew how to avoid them.

Re:Ask HN: What technologies did you learn in 2018? by pzixel on Sunday December 23, 2018 @05:36PM (#18748821)
1. Do you often try to implement data structures like this? In my practice, arrays are almost always better. 2. Beside that, you may argue that I use "Don't have therefore is not required" argument. But it contained partial truth: if you fight Rust program model then you have to do some extra steps to achieve it. Rust borrowing model considers one owner who can share its data among consumers. And this is damn common situation. I written a whole telegram bot with futures, using Arc container only once, to share my http client across the threads.

If you fight GC in Java then you have same troubles: all this stuff like weak pointers, byte array storages, reflection, etc, etc... If you are trying to write imperatively in haskell... And so on. If you fight language ideas, then your code becomes more complicated. The answer here is that you shouldn't have to do it often.

Re:Ask HN: What technologies did you learn in 2018? by amelius on Monday December 24, 2018 @08:50AM (#18752115)
To answer your first question:

> 1. Do you often try to implement data structures like this?

Any self-referential data-structure has this problem. So I guess my answer would be "yes".

Re:Ask HN: What technologies did you learn in 2018? by teacpde on Sunday December 23, 2018 @02:00PM (#18747691)
I was doing adventofcode this year using (and learning) Rust and had to write a doubly linked list. Impossible is obviously an exaggeration but I admit it is painful to wrap my head around it at the beginning. I had to google a reference implementation and understanding why it needs to be done that way is also not straightforward. It is definitely not the best thing to try out Rust with, but to me it is the best to force myself to really think hard and grasp the idea of ownership. Once I figured it out the complex becomes reasonable and I started to appreciate the safety aspect of Rust.

I also did the same puzzle with Go, it was such a breeze, it is as easy as to implement a doubly linked list in python/ruby/$yourfavoritescriptlanguage. But I start to dig Rust as it makes me think more and it feels like an eye opening experience.