Some people don’t like to say “my girlfriend”. They think it implies ownership over the person. Lets explore that using Rust. Swap genders at will.
Even though Rust is not object oriented, I’m sorry for objectifying Alice here.
This is what some people think when they hear “my girlfriend”, Bob owns Alice in this cenario.
Charlie can only borrow Alice, Bob maintains ownership of Alice, the compiler enforces monogamy.
That is not how it works, lets try again.
The name “Alice” refers to Alice, who is now owned by the reference counter. In this digital world it’s like a god, it decides who lives and dies.
“Bobs girlfriend” is a reference to Alice, no more or less than the name “Alice”. Bob owns the reference, but not Alice.
“Alice” and “Bobs girlfriend” are the same thing, though the latter is mutable and optional.
This throws a compiler error; Beauty is in the eye of the beholder.
Charlie does not own Alice either.
If you are forgotten, do you cease to exist? Better not find out. Love the ones dear to you. You’ll never know when they will be garbage collected.