Mit dating evaluation form
Call by sharing implies that values in the language are based on objects rather than primitive types, i.e. The semantics of call by sharing differ from call by reference: "In particular it is not call by value because mutations of arguments performed by the called routine will be visible to the caller.
And it is not call by reference because access is not given to the variables of the caller, but merely to certain objects".
In purely functional languages there is typically no semantic difference between the two strategies (since their data structures are immutable, so there is no possibility for a function to modify any of its arguments), so they are typically described as call by value even though implementations frequently use call by reference internally for the efficiency benefits.
Following is an example that demonstrates call by reference in E: Java (for object references), Ruby, Java Script, Scheme, OCaml, Apple Script, and many others.
Historically, call by value and call by name date back to ALGOL 60, a language designed in the late 1950s.
Modifications made via the data structure are reflected back to the value representation, and vice versa.
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 call by value.
However, since the function has access to the same object as the caller (no copy is made), mutations to those objects, if the objects are mutable, within the function are visible to the caller, which may appear to differ from call by value semantics.
Mutations of a mutable object within the function are visible to the caller because the object is not copied or cloned — it is shared.