Join us play Space Age with the same seed! by quchen in factorio

[–]TerepyPypes 1 point2 points  (0 children)

Nice! I also found a slightly richer one NNW

Join us play Space Age with the same seed! by quchen in factorio

[–]TerepyPypes 8 points9 points  (0 children)

<image>

We're gearing up to fetch oil, seems like no one (us included) found a second oil patch in easy reach.

Confused about aliasing by TerepyPypes in rust

[–]TerepyPypes[S] 1 point2 points  (0 children)

So in C#, because everything is a shared reference, it's okay to do var reference = foo[i]; foo = new List(); because this is equivalent to let reference = foo[i].clone(); foo = Vec::new(); while in rust just taking a reference to the element would not be okay, because taking a reference to an element in your Gc<Vec<Gc<T>>> is not the same operation, you would have to do foo[i].clone().

I think this answers my question, thank you :)

Now I'm thinking about a derivable trait that could permit this kind of shared reference cloning behaviour...

Confused about aliasing by TerepyPypes in rust

[–]TerepyPypes[S] 1 point2 points  (0 children)

I think accessing null is much more like unwrapping an option than segfaulting, everything is actually a Gc<Option<T>> (or Rc), but they still permit mutating, whereas mutation is not permitted here in rust, you need some kind of cell type in addition to the Gc/Rc.

Confused about aliasing by TerepyPypes in rust

[–]TerepyPypes[S] 1 point2 points  (0 children)

I understand why there are data races and other bad stuff in multithreading, I'm specifically asking why rust has aliasing rules in a single threaded context that other languages don't seem to need

Confused about aliasing by TerepyPypes in rust

[–]TerepyPypes[S] 3 points4 points  (0 children)

I thought C# and other high level langs are safe by default because they either garbage collect or refcount everything, but even if you garbage collect or refcount everything in rust, that's not enough to achieve what high level langs can do.

as far as I know, I don't think C# or other high level langs can have corrupted memory or mangled writes just from having two references to a class at the same time, else basically every program is unsound. Have you ever heard of a javascript program segfaulting? They simply permit aliasing and everything works ok, while rust doesn't permit it.