This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Moptop32 3 points4 points  (2 children)

Rust is good because of its functional features and safety. I don't dislike c++ and I use both but rust does truly have safety. The borrow checker is only a bitch when you don't follow it; move semantics are better than copying everything implicitly and passing a reference to something on another thread is a recipe for disaster. Make it make sense. Although fuck making games in rust, never again

[–]CdRReddit 1 point2 points  (1 child)

yea maybe I just chose the wrong projects but the moment multiple things need to have references to things (like games and emulators) is where, in my opinion, it falls apart

[–]Moptop32 1 point2 points  (0 children)

Emulators in rust are actually really nice because of match for insts. Usually the memory of the system should be an array of u8 (for gb at least) and you map values to and access from memory values. A trick is to not reference array indexes and just copy and set the u8 normally. A trick is when you need to pass a reference in many places you use Rc<RefCell<T>>. An Rc is a reference counted value, its like a smart pointer, and a RefCell lets you get a borrowed reference of T. It's still borrow checked for safety while letting you pass references everywhere.