Skip to content
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: Factor out BuiltinCallOrConstruct #2637

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

jmdyck
Copy link
Collaborator

@jmdyck jmdyck commented Jan 22, 2022

... so that the [[Construct]] for exotic built-ins can be defined properly, instead of "the same as [[Call]] except that step 10 is different".

The second commit is a bonus, changing "a built-in function" to "an exotic built-in function" where appropriate. This is mostly of benefit in 10.3 Built-in Function Objects, where (in the status quo) the reader could be misled into thinking that these internal methods are for all built-in functions.

Nihad86

This comment was marked as spam.

@doehyunbaek
Copy link
Contributor

doehyunbaek commented Jan 31, 2023

Hi, ESMeta typecheck is failing because of the change in

https://github.com/tc39/ecma262/pull/2637/files#diff-181371b08d71216599b0acccbaabd03c306da6de142ea6275c2135810999805aL13631-R13631

This is because ESMeta extract type of receiver parameter of internal methods by parsing strings that comes before F, which in this case changed from a built-in function object or a built-in function object that is not an ECMAScript function object.

If you order them like doehyunbaek@23b0c40, this will no longer fail.

As conditions specified inside parenthesis was already used to provide additional constraints when the builtiin [[Construct]] method applied, this also seems to be in-line with current practice.

@jmdyck
Copy link
Collaborator Author

jmdyck commented Jan 31, 2023

Thanks, but the outcome on that point probably depends on how #3007 is resolved.

@doehyunbaek
Copy link
Contributor

Oh, I didn't know there was another PR opened. Agreed on your point.

I will give further inputs when any esmeta-related problem arises again.

@jmdyck jmdyck changed the title Editorial: Factor out ExoticBuiltinCallOrConstruct Editorial: Factor out BuiltinCallOrConstruct Jul 22, 2023
@jmdyck
Copy link
Collaborator Author

jmdyck commented Jul 22, 2023

I decided to drop commits other than the first.

Because the status quo still says that a built-in function can be implemented either as an ECMAScript function or not, there are a few places where the spec says "a built-in function" but it's actually only talking about "a built-in function that isn't an ECMAScript function". Specifically:

  • 10.2.5 MakeConstructor
  • 10.3.1 [[Call]]
  • 10.3.2 [[Construct]]

In this PR, the second commit (and then the third commit, after #2969) tried to make those spots more precise. As I said in the message for the third commit:
"Yes, this is somewhat ugly. I'm hoping it's temporary until the spec stops caring about how a built-in is implemented."
However, the latter change may take a while, and there's no need for this PR to get entangled in it, so I've now dropped those commits.


Also, I've tweaked the first commit to rename the new AO from ExoticBuiltinCallOrConstruct to just BuiltinCallOrConstruct. (I.e., just go along with the current imprecision.)

I'm hoping these changes will make this PR easier to accept.

Copy link
Member

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

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

LGTM otherwise.

@bakkot bakkot added the ready to merge Editors believe this PR needs no further reviews, and is ready to land. label Aug 16, 2023
... so that 10.3.2 [[Construct]] can be defined properly, instead of
"the same as 10.3.1 [[Call]] except that step 10 is different".
@ljharb ljharb merged commit b916c76 into tc39:main Aug 16, 2023
6 checks passed
@jmdyck jmdyck deleted the CallOrConstruct branch August 17, 2023 15:50
zhangenming pushed a commit to zhangenming/ecma262 that referenced this pull request Dec 22, 2023
... so that 10.3.2 [[Construct]] can be defined properly, instead of
"the same as 10.3.1 [[Call]] except that step 10 is different".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial change 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.

7 participants