>
> Well, actually, there is nothing to indicate that these two objects are the same.
> A _javascript_ engine would create two objects, and if you were to change
> the properties of one, the other's properties would not automatically change.
Agreed. The example, and the way I am using this is strongly based on assumption that the objects are immutable.
We also need to remember, that JSON is widely used not only for representing _javascript_ objects, but also in other important cases -- for example to express the input data for REST web services (seen in practice with the most widely used HTTP verbs) and for their response.
JSON is just a specific serialization mechanism -- how JSON would be de-serialized depends solely on the receiving end -- it may be serialized to something completely different than a _javascript_ object.
Any good particular implementation would use objects immutability for sharing and efficiency.
For the XPath 3.1 map datatype, this is what makes possible to have efficient (sub-linear) implementations of map:put() and map:remove().
--
Cheers,
Dimitre Novatchev