I’ve been programming for decades, though usually for myself, not as a profession. My current go-to language is Python, but I’m thinking of learning either Swift (I’m currently on the Apple ecosystem), or Rust. Which one do you think will be the best in terms of machine learning support in a couple of years and how easy is it to build MacOS/ iOS apps on Rust?
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.
Hope you enjoy the instance!
Follow the wormhole through a path of communities !webdev@programming.dev
Isn’t that basically the same as how C++ RAII works?
deleted by creator
Pretty much, with some atomic additions like “you cannot mutate a reference when it is borrowed immutably elsewhere” or “you cannot borrow a reference mutably multiple times”.
Essentially although there are a few key differences:
You raised an issue that the other bulletpoint has the solution for, I really don’t see how these are “key differences”.
That’s what unique_ptr would be for. If you don’t want to leak ownership, unique pointer is exactly what you are looking for.
Well yeah, because that’s what shared_ptr is for. If you need to borrow references, then it’s a shared lifetime. If the code doesn’t participate in lifetime, then ofcourse you can pass a reference safely even to whatever a unique_ptr points to.
The last bulletpoint, sure that’s a key difference, but it’s partially incorrect. I deal with performance (as well as write Rust code professionally), this set of optimizations isn’t so impactful in an average large codebase. There’s no magical optimization that can be done to improve how fast objects get destroyed, but what you can optimize is aliasing issues, which languages like C++ and C have issues with (which is why vendor specific keywords like
__restrict
exists). This can have profound impact in very small segments of your codebase, though the average programmer is rarely ever going to run into that case.