News for hackers. Stuff that matters.
Re:Rust: Dropping heavy things in another thread can make yo... by masklinn on Saturday May 30, 2020 @03:21PM (#23363848)
> Is Rust basically based on unique_ptr?

Rust is based on ownership and statically checked move semantics (by default though can be opted out). So each item has a single owner (which is why Rust deals very badly with graphs, and more generally any situation where ownership is unclear) and the compiler will prevent you from using a moved object (unlike C++).

Separately it has a smart pointer which is the dual of unique_ptr (Box), with the guarantee noted above:

    let b = Box::new(1);
    drop(b);
    println!("{}", b);
will not compile because the second line moves the box, after which it can't be used because it's been removed entirely from this scope.
Re:Rust: Dropping heavy things in another thread can make yo... by wnoise on Saturday May 30, 2020 @04:02PM (#23364155)
> which is why Rust deals very badly with graphs, and more generally any situation where ownership is unclear

To be fair, so do 90+% of programmers. Much of rust's benefit in safe code is training programmers to avoid code like that where possible, and spreading design patterns that avoid it.