Remix.run Logo
rich_sasha 3 days ago

I'd say the complexities of Rust just lie elsewhere. Building a linked list is trivial in C++ (well, third time round, after two segfaults), whereas in Rust it requires a degree in borrow checker ology.

But yes, I used C++ extensively about 20 years ago and no longer understand any new developments in this language.

ithkuil 3 days ago | parent | next [-]

Writing linked lists in rust is super easy (just use box, rc etc).

Writingefficient linked lists in rust OTOH requires more advanced concepts.

But that's because the language gives you more guarantees about safety than C++. That safety is not only important for the implementation of your code but also for the memory safety of your code when combined with other code that calls your code

malkia 2 days ago | parent [-]

So it's easy, but complicates matter later.

ithkuil 11 hours ago | parent [-]

yep, as it should, since memory safety with explicit memory management is complicated. If you use a language that allows you to do it in a non-complicated way it's just shifting the complication somewhere else, and if you're not aware of that you will likely have an unsafe program that will contain memory safety bugs (which often become security issues)

steveklabnik 2 days ago | parent | prev [-]

You can write it in Rust with unsafe the same way you would in C++, so it's at least equivalent.