Assignment for mutable records
First, we understand that records are partial functions: properties -> location
Semantic domain extension
Include bottom in the event we access an undefined record attribute.
As arguments to functions
- pass-by-value states that we should allocate a new location in the store for the record.
- However, the locations still refer to the original locations.
Behaviour when properties reassigned
a = {'a': 1}
function f(o) {
o.a = 2;
}
f(a)
a // {'a': 2}
Behaviour when object reassigned
a = {'a': 1}
function f(o) {
a = 2; // different location instantiated for a, original a is not modified.
}
f(a)
a // {'a': 1}