Are the values of objects the references to them?

Danny Niu dannyniu at hotmail.com
Sat Aug 26 09:40:46 UTC 2017


Hi all, I've been struggling finding information on this, so let me open by asking the following question: 

Q1: If primitive types are passed by value and objects by reference when calling function, where is this characteristic of objects mentioned in the standard? 

I've been trying to find answers from various sources, and I tried asking at https://stackoverflow.com/questions/45388408 but no result had been satisfactory. People from https://stackoverflow.com/questions/518000 seems adamant that ES is a pass-by-value language, so I assumed the value of objects are their individuality. 

So I tried reasoning a bit further, since it is defined in the standard that objects are a collection of properties, its value must be the uniqueness of such collection. And this makes sense since similar features in other languages also implement objects as reference types. 

But is it possible that the standard intentionally left this "implementation-defined"? So here's my second question: 

Q2: What's the rationale if any, to not explicitly require that objects be viewed as reference when passed as arguments to functions and assigned to variables. 

Thanks. 


More information about the es-discuss mailing list