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

starlark: eta-abstract the new iterators #537

Merged
merged 1 commit into from
Apr 8, 2024
Merged

starlark: eta-abstract the new iterators #537

merged 1 commit into from
Apr 8, 2024

Conversation

adonovan
Copy link
Collaborator

@adonovan adonovan commented Apr 7, 2024

According to golang/go#66626 (comment), the convention for iterator methods is that they should return an iterator, not be an iterator. The caller thus uses this form:

for _ elem := range v.Elements() { ... }

not this one:

for _ elem := range v.Elements { ... }

This is unfortunately a breaking API change, but since go1.23 is not yet released, no-one should be using the new range syntax yet.

According to
golang/go#66626 (comment),
the convention for iterator methods is that they should return
an iterator, not be an iterator. The caller thus uses this form:

   for _ elem := range v.Elements() { ... }

not this one:

   for _ elem := range v.Elements { ... }

This is unfortunately a breaking API change, but since go1.23 is
not yet released, no-one should be using the new range syntax yet.
@adonovan adonovan requested a review from jayconrod April 7, 2024 18:41
@adonovan adonovan merged commit 3f0a370 into master Apr 8, 2024
27 checks passed
@adonovan adonovan deleted the iter-again branch April 8, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants