I know I have mentioned this before, but a lot of modern programming languages have a convention where variables are really references, and parameters are really these references passed by value.
That means you can do (alter syntax to fit the language you want):
some_object a;
some_object b = a;
do_something_to(a);
and this will also alter b, but you can't make a function that swaps two variables (because the references are by value and you can't alter the references).
Now, what I'm seriously wondering about is: what's the point? By having variables essentially be references, it's very easy to get spooky action at a distance (doing something to a also does something to b), and if you forget to do a deep copy (explicit clone), the bug can bite you in the behind later on. Furthermore, it's much easier to break encapsulation if you aren't careful (as shown here or here). Hence there's a clear cost.
One doesn't incur costs without thinking there's some benefit to outweigh those costs. But in the case of everything-is-a-reference, what is the benefit? That's a serious question, not a "bleh, it all sucks" rhetorical one. Is the benefit that you don't have to write copy constructors? Or that it's easier to pass singletons around? Or that you don't need syntax of the type void somefunction(input_object & reference, input_object copy) but can just do void somefunction(a, b) because everything's a reference anyway? Clearly there must be *something*, but I don't see it.
That means you can do (alter syntax to fit the language you want):
some_object a;
some_object b = a;
do_something_to(a);
and this will also alter b, but you can't make a function that swaps two variables (because the references are by value and you can't alter the references).
Now, what I'm seriously wondering about is: what's the point? By having variables essentially be references, it's very easy to get spooky action at a distance (doing something to a also does something to b), and if you forget to do a deep copy (explicit clone), the bug can bite you in the behind later on. Furthermore, it's much easier to break encapsulation if you aren't careful (as shown here or here). Hence there's a clear cost.
One doesn't incur costs without thinking there's some benefit to outweigh those costs. But in the case of everything-is-a-reference, what is the benefit? That's a serious question, not a "bleh, it all sucks" rhetorical one. Is the benefit that you don't have to write copy constructors? Or that it's easier to pass singletons around? Or that you don't need syntax of the type void somefunction(input_object & reference, input_object copy) but can just do void somefunction(a, b) because everything's a reference anyway? Clearly there must be *something*, but I don't see it.