One of the biggest annoyances I remember when learning scripting languages was wrapping my head around copy by reference. I came from a typical “C/C++ rules everything” background, and I was amazed how quickly I was able to pick up Python because it was oh so similar to C++. Except that copy and deepcopy made no sense to me. Yesterday I was learning object-oriented programming in PHP, and the __clone() method came up.
One might argue why the language designers have gone to such elaborate fence-building when it comes to copying objects? Why not simply copy by value and let that be the end of it. One explanation, of course, is memory usage. But I think it’s also part of language design philosophy.
The so-called modern languages were created to make programming faster and more intuitive. And so we have loose typing, which most people agree is a sanity-saver (including me). This is why when you write “$” * 4 in Python you get $$$$ and not an error; after all, if you forget about computer architecture for a while, isn’t that what you were trying to accomplish?
I think the same thing is going on in reference-based copying. When we write a = b, we tend to think in our minds that a and b are now identical. This means that if one part of a is changed, b is changed as well. Of course you might argue that it’s essentially mathematical notation and there it has no connotations of “identical-ness”; but hey, let’s not split hairs here.