8.2.4 The Reference Specification Type

# John J Barton (13 years ago)

I'm trying to decode section 8.2.4 The Reference Specification Type

I believe that it is trying to say obj.prop = ... obj is reference base prop is reference name

But base can also be Boolean, String, Number and env. record. I can't figure out what a reference name means in these cases. I guess the |name| is only relevant for Object, in which case the spec would be clearer if we called it a |property key|, as in GetReferencedPropertyKey(V). Returns the referenced property key component of the reference V.

jjb

# Brandon Benvie (13 years ago)

In that example "obj" itself would first have been a Reference with no base and the name "obj" which would resolve to an environment record. Then after "prop" would be another Reference with the resolved obj as its base and "prop" as the name.

# Brandon Benvie (13 years ago)

Er I was a bit unclear. It would look like:

objReference = { base: undefined, name: "obj" };

Which would resolve to the object obj, on an environment record.

objPropRefence = { base: IdentifierResolution(objReference), name: "prop" }

# Allen Wirfs-Brock (13 years ago)

On Dec 18, 2012, at 10:42 AM, John J Barton wrote:

I'm trying to decode section 8.2.4 The Reference Specification Type

I believe that it is trying to say obj.prop = ... obj is reference base prop is reference name

But base can also be Boolean, String, Number and env. record. I can't figure out what a reference name means in these cases. I guess the |name| is only relevant for Object, in which case the spec would be clearer if we called it a |property key|, as in GetReferencedPropertyKey(V). Returns the referenced property key component of the reference V.

I'r all in 8.2.4.1 and 8.2.4.2 (GetValue/SetValue).

Consider an expression like: 123.0.toFixed

This evaluates to a Reference value {base: 0, referenced name: "toFixed", strict: false} (or strict is true if in strict code)

GetValue/SetValue explicitly coerces primitive base values to Objects in order to do property lookup.

In general, within the ES6 spec, the introduction of symbols as property keys introduces some confusion about the implications of the work "name". I'm slowly migrating some uses of "name" to "key". However, symbols doesn't seem to be the source of your problem here.

# Allen Wirfs-Brock (13 years ago)

oops, I meant {base: 123.0, referenced name: "toFixed", strict: false} below

# John J Barton (13 years ago)

On Tue, Dec 18, 2012 at 11:39 AM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:

...

I'r all in 8.2.4.1 and 8.2.4.2 (GetValue/SetValue).

Consider an expression like: 123.0.toFixed

This evaluates to a Reference value {base: 0, referenced name: "toFixed", strict: false} (or strict is true if in strict code)

GetValue/SetValue explicitly coerces primitive base values to Objects in order to do property lookup.

In general, within the ES6 spec, the introduction of symbols as property keys introduces some confusion about the implications of the work "name". I'm slowly migrating some uses of "name" to "key". However, symbols doesn't seem to be the source of your problem here.

No, indeed. The source of my problem was to much C-heritage: I could not imagine 123.0.toFixed(). (Plus that could not be the explanation since I've not been able to understand any of the discussion about the mysterious 'symbols' ;-)

Thanks, jjb