Skip to content

is iterate allowed to return something other than a Tuple{Any, Any}, when it does not return a Nothing? #59153

@nsajko

Description

@nsajko

Apparently it's sometimes desirable to have iterate return a collection type other than Tuple{Any, Any}. While the interfaces seem to allow this as coded, the documentation does not. Should the docs be updated?

AFAIK, it is permitted for any two-element struct to be returned (such as NamedTuple or Pair), as long as it implements indexing corresponding to fields

Okay, then I guess we probably need to update the docstring for iterate (https://docs.julialang.org/en/v1.13-dev/base/collections/#Base.iterate) too..

xref #59142

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingThis change will break codedesignDesign of APIs or of the language itselfdocsThis change adds or pertains to documentationiterationInvolves iteration or the iteration protocol

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions