▲ | thomasmg 3 days ago | |
> In Rust you can hold references directly into the buffer backing the array Yes! But I am arguing that this prevents having multiple mutable references > My Java knowledge is quite rusty > Also because Java is a GC'ed VM ... Your Java knowledge is fine :-) But I'm arguing that you don't strictly need a GC'ed, or RC'ed language: if done "correctly", multiple mutable references are possible. Just not with fat pointers! The programming language I'm building allows this even today. You can try it in the playground [1]:
So "List+" is owned type (just "List" without "+" would be reference counted). You may want to look at the generated C code at the end of the page. | ||
▲ | john-h-k 3 days ago | parent [-] | |
You are borrowing the entire list. That’s fine. The problem occurs if you borrow a reference into the list. Java/C# solve this by making that operation impossible. You cannot hold a reference into a vector/list |