New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial: contradiction re Function instances #876

Closed
jmdyck opened this Issue Apr 7, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@jmdyck
Collaborator

jmdyck commented Apr 7, 2017

Function Instances says:

Every function instance is an ECMAScript function object and has the internal slots listed in Table 27. Function instances created using the Function.prototype.bind method (19.2.3.2) have the internal slots listed in Table 28.

But Function.prototype.bind creates bound function exotic objects, which are not ECMAScript function objects, so there is a contradiction.

(In passing, "function instance" in the first sentence should presumably be "Function instance".)

Here are a couple possibilities (there may be others):

  • The first sentence is incorrect: not every Function instance is an ECMAScript function object. (Could fix by deleting "ECMAScript".)
  • The second sentence is incorrect: functions created by Function.prototype.bind are not Function instances. (Could fix by changing "Function instances" to "Function objects", and maybe adding that they're not Function instances.)

This is complicated by the fact that the spec doesn't clearly say was it means by "X instance" where X is some constructor. I'm guessing it means 'instance' in more or less the sense of the 'instanceof' operator. But I'm still not sure how to resolve the contradiction.

@anba

This comment has been minimized.

Show comment
Hide comment
@anba

anba Apr 7, 2017

Contributor

I went with the second option in #866 (3e02a57).

Contributor

anba commented Apr 7, 2017

I went with the second option in #866 (3e02a57).

@claudepache

This comment has been minimized.

Show comment
Hide comment
@claudepache

claudepache Apr 7, 2017

Contributor

This is complicated by the fact that the spec doesn't clearly say was it means by "X instance" where X is some constructor.

Indeed, what is a Function instance, to begin with? Following the definition, the issue may also stand for built-in functions, since they are not necessarily implemented as ECMAScript functions.

Contributor

claudepache commented Apr 7, 2017

This is complicated by the fact that the spec doesn't clearly say was it means by "X instance" where X is some constructor.

Indeed, what is a Function instance, to begin with? Following the definition, the issue may also stand for built-in functions, since they are not necessarily implemented as ECMAScript functions.

@jmdyck

This comment has been minimized.

Show comment
Hide comment
@jmdyck

jmdyck Apr 7, 2017

Collaborator

I went with the second option in #866.

Ah, so you did.

@bterlson, you can close this as a duplicate unless you think it warrants discussion. (Or unless you think it needs a different solution than 3e02a57.)

Collaborator

jmdyck commented Apr 7, 2017

I went with the second option in #866.

Ah, so you did.

@bterlson, you can close this as a duplicate unless you think it warrants discussion. (Or unless you think it needs a different solution than 3e02a57.)

@bterlson bterlson closed this Jun 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment