I am referring to various discussions on the differences and nuances in the semantics of pass-by-value, pass-by-reference, e.g. in SO or in the Wikipedia article on the subject.
My question is why do these articles and conversations always discuss pass-by-value, pass-by-reference, etc. solely in the context of parameter passing and function calls and not in the context of assignments?
E.g. assuming the following:
A a1 = new A();
A a2 = a1;
… why is it taken for granted that the assigned object is not copied by value?
I am not asking why it would be a questionable language design decision to make the semantics of the assignment copy the object “by value” – I am asking whether and under what terminology language specifications explicitly spell this out or under what heading language design theory treats such decisions.
3
My question is why do these articles and conversations always discuss pass-by-value, pass-by-reference, etc. solely in the context of parameter passing and function calls and not in the context of assignments?
As Doval mentions in the comments, the primary reason is that assignment is often modeled as a function call (and can thus be ignored).
why is it taken for granted that the assigned object is not copied by value?
You mean like in C, C++ and a pile of other languages? These days, the most common reason is that copying non-trivial objects is not an atomic operation. Since it’s not an atomic operation, it makes it a lot more difficult to make concurrent programs safely, which is already plenty difficult.
Also, because most programmers often don’t want value semantics for their objects.
I am asking whether and under what terminology language specifications explicitly spell this out or under what heading language design theory treats such decisions.
The common terms are reference/value types and reference/value semantics (as mentioned in the comments).
2