News for hackers. Stuff that matters.
Re:A 30 minute introduction to Rust by 45g on Monday January 13, 2014 @01:47PM (#7052488)
> You can see how this makes it impossible to mutate the state without remembering to aquire the lock.

Not quite true. Looking at the type signature of e.g. RWArc::write I see this:

    fn write<U>(&self, blk: |x: &mut T| -> U) -> U
which means I could probably do:

    let mut n = local_arc.write(|nums| {
         nums[num] += 1;
         return ~(*nums);
     });
    n[2] = 42;
Re:A 30 minute introduction to Rust by eridius on Monday January 13, 2014 @01:55PM (#7052534)
You're not letting anything escape. You're copying `nums` and then mutating your copy. And this only works because `nums` can be implicitly copied like this. If you changed it from `[int, ..3]` to `~[int]` you'd get a compiler error (as `~[T]` cannot be implicitly copied).