diff options
| author | Josh Bleecher Snyder <josharian@gmail.com> | 2019-04-22 13:37:08 -0700 |
|---|---|---|
| committer | Josh Bleecher Snyder <josharian@gmail.com> | 2019-04-30 18:18:12 +0000 |
| commit | 73cb9a1cb3d9d31a8276aaa2aebfb8b35509e05c (patch) | |
| tree | 2811c612c1eb11bc686626310ee50b4a4be6709e /src/runtime/type.go | |
| parent | a8d0047e473510db1b1a5e35c03fdf41a13b5733 (diff) | |
| download | go-73cb9a1cb3d9d31a8276aaa2aebfb8b35509e05c.tar.xz | |
all: refer to map elements as elements instead of values
The spec carefully and consistently uses "key" and "element"
as map terminology. The implementation, not so much.
This change attempts to make the implementation consistently
hew to the spec's terminology. Beyond consistency, this has
the advantage of avoid some confusion and naming collisions,
since v and value are very generic and commonly used terms.
I believe that I found all everything, but there are a lot of
non-obvious places for these to hide, and grepping for them is hard.
Hopefully this change changes enough of them that we will start using
elem going forward. Any remaining hidden cases can be removed ad hoc
as they are discovered.
The only externally-facing part of this change is in package reflect,
where there is a minor doc change and a function parameter name change.
Updates #27167
Change-Id: I2f2d78f16c360dc39007b9966d5c2046a29d3701
Reviewed-on: https://go-review.googlesource.com/c/go/+/174523
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/type.go')
| -rw-r--r-- | src/runtime/type.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/type.go b/src/runtime/type.go index dc7f62eff7..660b45ef39 100644 --- a/src/runtime/type.go +++ b/src/runtime/type.go @@ -363,7 +363,7 @@ type maptype struct { elem *_type bucket *_type // internal type representing a hash bucket keysize uint8 // size of key slot - valuesize uint8 // size of value slot + elemsize uint8 // size of elem slot bucketsize uint16 // size of bucket flags uint32 } @@ -373,7 +373,7 @@ type maptype struct { func (mt *maptype) indirectkey() bool { // store ptr to key instead of key itself return mt.flags&1 != 0 } -func (mt *maptype) indirectvalue() bool { // store ptr to value instead of value itself +func (mt *maptype) indirectelem() bool { // store ptr to elem instead of elem itself return mt.flags&2 != 0 } func (mt *maptype) reflexivekey() bool { // true if k==k for all keys |
