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

Iterable.any docs slightly unclear? #59576

Open
ditman opened this issue Nov 21, 2024 · 2 comments
Open

Iterable.any docs slightly unclear? #59576

ditman opened this issue Nov 21, 2024 · 2 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. type-documentation A request to add or improve documentation type-enhancement A request for a change that isn't a bug

Comments

@ditman
Copy link
Member

ditman commented Nov 21, 2024

I was reading the docs for Iterable.any and it says this:

Checks every element in iteration order, and returns true if any of them make test return true, otherwise returns false. Returns false if the iterable is empty.

At first I thought that it'd check every (all) element in iteration order, then return true if any of them makes test return true.

But the implementation actually returns immediately:

I think something like this may be clearer:

"Checks elements in iteration order, and returns true when any of them makes test return true, otherwise returns false."

(This maybe too subtle a change for my level of english, though 😅)

@dart-github-bot
Copy link
Collaborator

Summary: User finds Iterable.any documentation unclear. The current wording implies a complete iteration before returning, while it short-circuits.

@dart-github-bot dart-github-bot added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-enhancement A request for a change that isn't a bug labels Nov 21, 2024
@lrhn lrhn added type-documentation A request to add or improve documentation and removed triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. labels Nov 21, 2024
@lrhn
Copy link
Member

lrhn commented Nov 21, 2024

Old docs are often quite terse. Makes sense to write something more here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. type-documentation A request to add or improve documentation type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants