function func(obj) { ... }

var = { ... };

func( var );


와 같은 상황에서 일어나는 걸 Call by value, Call by reference라는 용어 대신 구분해서

Call by sharing (a.k.a Call by object, Call by object-sharing) 이라는 용어를 만들어서 구분하고 있다.


Call by sharing


Also known as "call by object" or "call by object-sharing," call by sharing is an evaluation strategy first named by Barbara Liskov et al. for the language CLU in 1974.[5] It is used by languages such as Python,[6] Iota, Java (for object references),[7] Ruby, JavaScript, Scheme, OCaml, AppleScript, and many others. However, the term "call by sharing" is not in common use; the terminology is inconsistent across different sources. For example, in the Java community, they say that Java is pass-by-value, whereas in the Ruby community, they say that Ruby is pass-by-reference, even though the two languages exhibit the same semantics. Call by sharing implies that values in the language are based on objects rather than primitive types, i.e. that all values are "boxed".


이걸 call by value, call by reference 어느 쪽으로 생각할지는 엿장수 마음이라네.

객체 자체를 기준으로 생각하면 copy란 말 그대로 객체가 복사되어야 하는 거고,

객체 참조를 기준으로 생각하면 copy란 참조만 복사되어야 하는 거겠지.