Skip to content

spec: wording about nil maps is confusing #4253

@Sajmani

Description

@Sajmani
One line in the Go spec says:
  A nil map is equivalent to an empty map except that no elements may be added.

That led me to believe that deletion from a nil map should work.  But another line in
the spec says:
  If the element m[k] does not exist, delete is a no-op. Calling delete with a nil map causes a run-time panic.

While this is clear, it appears to contradict the first statement.  Can we improve the
first statement?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions