Are the values of objects the references to them?

Jordan Harband ljharb at
Sat Aug 26 20:42:32 UTC 2017

Things in JS are passed (to functions) by value, because direct assignment
to the binding isn't visible outside the function (take no note of
sloppy-mode `arguments` over there behind the curtain. ES Module
live-bindings of exports add a wrinkle, as well)

I've found

On Sat, Aug 26, 2017 at 1:26 PM, Michael Dyck <jmdyck at> wrote:

> On 2017-08-26 05:40 AM, Danny Niu wrote:
>> 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?
> Objects aren't "passed by reference" according to the original/usual sense
> of that term.
> People from seems adamant that
>> ES is a pass-by-value language, so I assumed the value of objects are
>> their individuality.
> The top two answers there both say (more or less) it's pass-by-value, and
> for objects, the 'value' is a reference to the object.
> So you might wonder why objects are special in this regard. But they
> aren't:
> if you like, you can imagine everything being passed by value, where the
> 'value' is a reference to the thing.
> 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.
> One reason might be to avoid confusion with the Reference type. Another
> reason might be to avoid making a distinction that the spec will never (or
> rarely) use.
> When you pass a value to a function-parameter or assign a value to a
> variable, you are (in spec terms, more or less) binding that value to an
> identifier name, i.e., creating an association between the name and the
> value.
> Given that terminology, I don't think it helps to add "reference" to the
> description. It's enough to understand that a value can participate in
> multiple bindings/associations at the same time. But you're free to imagine
> references being involved in the implementation.
> -Michael
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list