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: Clarify GetIterator #3021

Merged
merged 4 commits into from
Mar 30, 2023
Merged

Editorial: Clarify GetIterator #3021

merged 4 commits into from
Mar 30, 2023

Conversation

syg
Copy link
Contributor

@syg syg commented Mar 1, 2023

I find GetIterator's optional parameters confusing because the hint is ignored when the method is passed. There's also a recursive call that serves no real purpose.

This PR gets rid of the optional parameters and does some refactoring.

@syg syg requested a review from a team March 1, 2023 22:31
@syg
Copy link
Contributor Author

syg commented Mar 1, 2023

It's easiest to review this PR commit by commit.

@syg syg changed the title Clarify getiterator Editorial: Clarify GetIterator Mar 1, 2023
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.

This is an improvement and doesn't impact the iterator helpers proposal.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

I implemented all the AO changes in es-abstract, and it looks good to me. Additionally, iterator helpers' GetIteratorDirect AO is basically the last 4 steps of GetIteratorFromMethod, so it seems pretty compatible there.

jmdyck
jmdyck previously requested changes Mar 2, 2023
spec.html Show resolved Hide resolved
spec.html Outdated Show resolved Hide resolved
gibson042 added a commit to gibson042/ecma402 that referenced this pull request Mar 2, 2023
tc39/ecma262#3021 proposes removing optionality from the second argument
Copy link
Contributor

@gibson042 gibson042 left a comment

Choose a reason for hiding this comment

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

I think you missed the downstream consumers check, but I've opened tc39/ecma402#756 to be ready.

spec.html Outdated
Comment on lines 7001 to 7014
IterableToList (
_items_: an ECMAScript language value,
optional _method_: a function object,
IteratorToList (
_iteratorRecord_: an Iterator Record
): either a normal completion containing a List of ECMAScript language values or a throw completion
Copy link
Contributor

Choose a reason for hiding this comment

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

@ptomato Assuming this lands, Temporal IterableToListOfType should probably change accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you.

ryzokuken pushed a commit to tc39/ecma402 that referenced this pull request Mar 7, 2023
tc39/ecma262#3021 proposes removing optionality from the second argument
Copy link
Contributor

@bakkot bakkot left a comment

Choose a reason for hiding this comment

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

Much nicer.

@bakkot bakkot added the ready to merge Editors believe this PR needs no further reviews, and is ready to land. label Mar 29, 2023
syg added 4 commits March 30, 2023 16:17
This removes the optional _hint_ parameter and the weird recursive call
in GetIterator.
Also remove the the optional method parameter and change the callsites
to explicitly get the iterator.
This is editorial because Call inside GetIteratorFromMethod would throw
on undefined anyways, and this keeps GetIteratorFromMethod cleaner in
only accepting function objects.
@ljharb ljharb dismissed jmdyck’s stale review March 30, 2023 23:18

Changes addressed

@ljharb ljharb merged commit 784fc65 into tc39:main Mar 30, 2023
ptomato added a commit to tc39/proposal-temporal that referenced this pull request Apr 15, 2023
Based on the rewrite of IterableToList in
tc39/ecma262#3021, this makes the corresponding
change to IterableToListOfType.
Ms2ger pushed a commit to tc39/proposal-temporal that referenced this pull request Apr 17, 2023
Based on the rewrite of IterableToList in
tc39/ecma262#3021, this makes the corresponding
change to IterableToListOfType.
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.

None yet

6 participants