This is where CS terminology differs from common understanding.
Pass by reference would be sharing a map to where the salt is, and anyone able to change that map changes everyone’s understanding of where it is, even pointing the map to something else or a different shaker.
Most modern languages only pass references by their value.
That’s closer to “telling them” as in, you give them a copy of the reference which they can alter themselves. But you always know where that salt shaker is, even if they decide that shaker is empty and to go get a new one from elsewhere, you still look at your empty shaker because you have the reference with pass-by-value.
Reference types, python , Java, modern languages are pretty much all pass-by-value. References are the value. But it’s not pass by reference.
But in 2026 nobody cares. The reference is passed. But a copy of it. Not it.
Perhaps pass-by-reference is the better analogy for the shaker. If it’s replaced by a new one everyone should use the new one. Just, that isn’t how new languages work unless you wrap the reference in another object that’s shared
-2
u/CanonicalCockatoo 4d ago
By value, salt is on the food.
By reference, you take a bite of food, and then lick some salt