archives

« Bugzilla Issues Index

#3518 — Array method ToObject language inconsistencies


Two things:

1. Why this:

"Let O be the result of calling ToObject passing the this value as the argument."

And not this:

"Let O be ToObject(this)"

2. Array.prototype.toString ( ) says:

"Let array be the result of calling ToObject on the this value."

But all the others have as shown above


String.prototype.* all appear to be satisfied with:


Let O be RequireObjectCoercible(this value).
Let S be ToString(O).
ReturnIfAbrupt(S).


Shouldn't Array.prototype methods read:

Let O be RequireObjectCoercible(this value).
Let A be ToObject(O).
ReturnIfAbrupt(A).


Well, "this" isn't really precise enough. The "this value" (or thisValue) has a specific meaning defined within the spec, for example: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-function-environment-records snd http://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-function-objects

But mostly what you are seeing is just accumulated editorial variations in a very old document that has been touched by several hands. It would be nice to clean them all up, but we probably won't get that gone in ES6.

Going forward, my preference is ToObject(this value), even though I continue to be a little hesitant to use phrases like that without functional notation.


fixed in rev33 editor's draft