Hacker News new | past | comments | ask | show | jobs | submit login

It's interesting that Rust doesn't have immutable data. It "only" prevents shared mutable data, but you can always mutate data if nobody else can observe it:

    let bar = [456, 789]; // const binding to owned data
    let mut bar = bar; // allowed if nobody else can see `bar`
    bar[0] = 123; // OK!
Immutability in Rust is not property of the data, but the way you access it.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: