spec: document special cases for floating-point maps #24049
In #20660 (comment), I noted that there are undocumented special cases in the handling of maps with floating-point keys.
Regardless of what happens with that proposal for Go 2, we should fix the Go 1 spec to properly document those cases.
In Map types, add:
Elements may be added during execution using assignments and retrieved with index expressions and range clauses; they may be removed with the
In Index expressions, add:
For a of map type
In Assignments, add:
The assignment proceeds in two phases. First, the operands of index expressions and pointer indirections (including implicit pointer indirections in selectors) on the left and the expressions on the right are all evaluated in the usual order. Second, the assignments are carried out in left-to-right order.
If the left operand of an assignment is an index expression on a map that does not contain a key equal to the given key, the assignment creates a new entry in the map. If the map is
In For statements with
In Deletion of map elements, add:
The built-in function delete removes the element with key equal to
The text was updated successfully, but these errors were encountered:
Let me pick just one example from the list to illustrate the more general principle seen in the proposal:
This is true. It was true before this proposal and it will remain true if the proposal is adopted. I don't think it adds something new to the documentation. Just saying that
Yes, that is the case for all documentation issues.
That is the information that is currently missing from the documentation.