Skip to content
New issue

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

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

Already on GitHub? # to your account

Editorial: consider built-in functions to be ordinary objects #2969

Merged
merged 1 commit into from
Dec 14, 2022

Conversation

michaelficarra
Copy link
Member

This should implement the resolution to @jmdyck's concern in #2942 (comment).

@michaelficarra michaelficarra added the editor call to be discussed in the next editor call label Dec 6, 2022
@michaelficarra michaelficarra requested a review from jmdyck December 6, 2022 01:23
jmdyck
jmdyck previously requested changes Dec 7, 2022
Copy link
Collaborator

@jmdyck jmdyck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this change, 10.3 "Built-in Function Objects" is now incorrect. It says that a built-in function may be implemented as either:

  • an ECMAScript function object (using 10.2.1 [[Call]]), or
  • a function exotic object, using 10.3.1 [[Call]].

But in this PR, an object using 10.3.1 [[Call]] is no longer exotic.

10.3 has 3 occurrences of "exotic". I suggest the following fixes:

  • Delete the first.
  • Change "is implemented as an exotic object" to "is not implemented as an ECMAScript function object".
  • Delete the third.

(Interestingly, the resulting wording is also compatible with the status quo's definition of ordinary function.)


In the status quo, "ordinary function" means the same as "ECMAScript function",
so "Ordinary" is used in the names of various operations that are specific to ECMAScript functions:

  • PrepareForOrdinaryCall
  • OrdinaryCallBindThis
  • OrdinaryCallEvaluateBody
  • OrdinaryFunctionCreate

But in this PR, ECMAScript functions become a subset of ordinary functions, so using "Ordinary" in these contexts is misleading, so the operations should maybe be renamed. Possibly:

  • "OrdinaryCall" -> "ECMAScriptFunctionCall"
  • OrdinaryFunction" -> "ECMAScriptFunction"

@michaelficarra michaelficarra removed the editor call to be discussed in the next editor call label Dec 7, 2022
@bakkot bakkot added the ready to merge Editors believe this PR needs no further reviews, and is ready to land. label Dec 7, 2022
@jmdyck
Copy link
Collaborator

jmdyck commented Dec 8, 2022

This should implement the resolution to @jmdyck's concern in #2942 (comment).

As I point out there, I don't think it resolves my concern.

(Which might affect whether you want to merge it, but might not.)

@ljharb ljharb force-pushed the builtin-functions-are-ordinary-too branch from b88b73f to 907276f Compare December 10, 2022 05:55
@ljharb ljharb dismissed jmdyck’s stale review December 14, 2022 22:42

as discussed

@ljharb ljharb merged commit 907276f into main Dec 14, 2022
@ljharb ljharb deleted the builtin-functions-are-ordinary-too branch December 14, 2022 22:42
jmdyck added a commit to jmdyck/ecma262 that referenced this pull request Jan 29, 2023
PR tc39#2969 changed the definition of "ordinary function"
to include all built-in functions (however implemented).

So change "an exotic built-in function object" to
"a built-in function object that is not an ECMAScript function object".

Yes, this is somewhat ugly. I'm hoping it's temporary
until the spec stops caring about how a built-in is implemented.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
ready to merge Editors believe this PR needs no further reviews, and is ready to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants