The Handle trait (smallcultfollowing.com)
from SorteKanin@feddit.dk to rust@programming.dev on 08 Oct 08:06
https://feddit.dk/post/16339949

#rust

threaded - newest

INeedMana@piefed.zip on 08 Oct 10:22 next collapse

Why not just expand meaning of &?

let l_before = &v1;

TechnoCat@lemmy.ml on 08 Oct 10:28 collapse

Without ref counting it is hard to know when to free or safely change a value with multiple consumers

INeedMana@piefed.zip on 08 Oct 10:41 collapse

I mean, keep the ref-counting. Just from the syntax perspective. Aligning with the example in the post: & before Arc would increment reference count, before a Mutex would reference the same object as it does now

TechnoCat@lemmy.ml on 08 Oct 10:30 collapse

The semantics of something like Handle does add a lot of clarity for me. I had just written an app using tokio and arc and the clones always felt off.