News for hackers. Stuff that matters.
Re:How I went about learning Rust by hyperman1 on Friday July 15, 2022 @04:23AM (#32105990)
For me it was the web-of-pointers strategy I had to unlearn. A child object keeping a pointer to its parent is misery in Rust. It forces you to either make the child completely independent or really prove the parent will be around until the child disappears.

90% of the time this is dumb overhead, but 10% of the time it found a bug in some edge case, so I learned to appreciate it as a tough teacher, and my designs got better for it.

Re:How I went about learning Rust by pimeys on Friday July 15, 2022 @12:51PM (#32110161)
We solved this with flat vectors and just sharing index values in cheap walker objects. It is much nicer to work with compared to arc/weak pointers.

Code here: https://github.com/prisma/prisma-engines/tree/main/libs%2Fda...

Re:How I went about learning Rust by int_19h on Friday July 15, 2022 @04:20PM (#32112322)
How is this fundamentally different from raw pointers?
Re:How I went about learning Rust by dralley on Friday July 15, 2022 @07:44PM (#32113930)
Not OP

It serializes better, it's memory safe, it can be much faster in performance terms, you can get better memory usage if you're holding a lot of "pointers" because the indexes don't need to be 64 bits.

Re:How I went about learning Rust by int_19h on Saturday July 16, 2022 @04:03AM (#32116096)
But you lose all ownership tracking / safety that Rust is famous for.

I just can't help but wonder what it means for that paradigm, when the most popular answer to "how do I model my entities in safe Rust" is basically "backdoor the safety".

Re:How I went about learning Rust by pflanze on Saturday July 16, 2022 @10:22AM (#32118419)
Which way did you go, (1) not use pointers from child to parent (functional programming approach), or (2) kept using such pointers but made it work? Your first paragraph sounds like (1), but the second sounds like (2).

If it was (2), it sounds like you made it work without unsafe code? Can you share some code?

Re:How I went about learning Rust by philosopher1234 on Friday July 15, 2022 @11:20AM (#32109044)
> designs got better for it.

What is better about them?

Re:How I went about learning Rust by FpUser on Friday July 15, 2022 @09:20AM (#32107879)
>"90% of the time this is dumb overhead, but 10% of the time it found a bug in some edge case, so I learned to appreciate it as a tough teacher, and my designs got better for it."

Sounds kind of like Stockholm syndrome

Re:How I went about learning Rust by atoav on Saturday July 16, 2022 @06:23AM (#32116690)
And you sound like you are part of the reason why we still have exploitable null-pointer bugs in 2022. Imagine a structural engineer that would say "all that static and dynamic analysis is dumb overhead 90% of the time, so I am going to skip it". Imagine an electrical engineer who would go like "all these wire gauge calculations are exhausting, 90% of the time my installations don't catch fire"

Seriously, I sometimes wonder what is wrong with the whole field of software development.

Re:How I went about learning Rust by FpUser on Saturday July 16, 2022 @11:51AM (#32119258)
Nothing is wrong. Same shit as in any other area. It is a usual trade-off between what you pay and what you get in return, some of it highly politicized.