archives

« Bugzilla Issues Index

#1341 — "this function object" / "owner object"


In:
15.13.5.2.1 ArrayBuffer(length)
15.13.6.1.1 TypedArray ( length )
15.13.6.1.2 TypedArray ( typedArray )
15.13.6.1.3 TypedArray ( array )
the algorithm refers to "this function object", which is not defined.

Analogy with "this Date object" of 15.9.5 would suggest that it means:
the object that is the 'this' value for the invocation of the function
but this is presumably not the case, because each of the 4 algorithms,
prior to referring to "this function object", has already referred to
"the 'this' value" and found it wanting.

My guess is that "this function object" means:
the function object whose [[Call]] internal method
is the "current" algorithm

It would be good if the spec defined a term for this (generalized to any internal method). E.g., "owner object".

Section 8.1.6.2 says:
In addition to its parameters, an internal method always has access to
the object upon which it is invoked as a method.
To this, you could add something like:
Specifically, when the spec refers to calling/invoking/performing
a particular internal method of an object, [the algorithm bound to]
that internal method can refer to that object as the *owner object*.

(Is this the same concept as 8.1.6.3's "target"? Note that the word "target" is used with other senses elsewhere in the spec, but the word "owner" has the advantage of not being used at all yet in the spec.)

Then,
Let F be this function object.
could become:
Let F be the owner object.
Assert: F is a function object.

I think it's also the case that occurrences of
the Foo function object on which the 'new' operator was applied
could be replaced by just
the owner object


Ditto references to "this function" in:
15.4.1.1 Array ( [ item1 [ , item2 [ , [...] ] ] ] )
15.4.1.2 Array (len)
I think.


And ditto:
15.11.1.1: "the Error function object"
15.11.7.1.1: "this NativeError function object"
15.11.7.2.1: "this NativeError function object"
15.10.3.1: "this RegExp function object"


In a related bit of terminology, every occurrence of "this Function object" is in a pair of steps of the form:
a. Let F be this function object.
b. Let argumentsList be the argumentsList argument of
the [[Call]] internal method that invoked F.

But it seems to me that that phrase:
"the [[Call]] internal method that invoked F"
is incorrect: the [[Call]] internal method doesn't *invoke* F,
it merely belongs to F, and it is invoked as a consequence of F being invoked.


re comment 1:
The phrase "this function object" was mostly eliminated in rev16, then completely gone in rev19.

re comment 2:
rev24 has 3 occurrences of "Let /F/ be this function.":
22.1.1.1 / step 5.a
22.1.1.2 / step 5.a
22.1.1.3 / step 5.a

Also,
19.2.1.1 / step 15.a
25.2.1.1 / step 15.a
have "Let /C/ be the function that is currently being evaluated."

re comment 3:
rev24 has:
19.5.1.1 / step 1: "this Error function object"
19.5.6.1.1 / step 1: "this /NativeError/ function object"
19.5.6.1.2 / step 1: "this /NativeError/ function object"
21.2.3.1 / step 1: "this RegExp function object"

re comment 4:
rev24 has, in 22.2.4.1 / step 9:
Let /argumentsList/ be the /argumentsList/ argument of
the [[Call]] internal method that invoked /F/.


fixed in rev26 editor's draft

in 8.3 defined the term "active function" and used in in all the remaining situations "this function object", etc. situations.


in rev26 draft