Skip to content

spec: clarify deletion of map entries during iteration #8558

Closed
@gopherbot

Description

@gopherbot

by peterbourgon:

In the spec, under "For statements", the topic of deleting map entries during
iteration is addressed with only the sentence:

> If map entries that have not yet been reached are removed during iteration, the
corresponding iteration values will not be produced.

This program appears to work fine:

> http://play.golang.org/p/P-O47Wp2LF

But the spec doesn't seem to *guarantee* that it will work. If this is guaranteed
behavior, can the spec be clarified? Specifically, can this sentence (or one like it) be
added:

> The current entry in a map iteration may be safely deleted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions