Reply to post: Yeah They're Wrong

Rust is eating into our systems, and it's a good thing

zac_harrold
Facepalm

Yeah They're Wrong

Below is a complete snippet of Rust code that performs exactly what they say is impossible:

fn main() {

let x: f64 = 1.234;

let a = x.sin();

let b = x.cos();

}

What I think they were trying to refer to is the ownership system in Rust, which allows unlimited read-only references to a variable, but only 1 owner. If sin() or cos() modified x directly, then they would be correct in saying Rust wouldn't allow that code.

For anyone interested in learning more, the Rust Docs have a pretty detailed section describing the concept of ownership: https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon