Re: [go-nuts] retaining mapiterkey return values in *reflect.MapIter

2020-06-30 Thread 'Dan Kortschak' via golang-nuts
Looking again, the second part of my question was wrong (it is a call to `mapiterkey` and then `mapiterelem` in `Value`). The code for Key and Value are almost identical, so the question whether to send a change boils down whether the similarity between the two is a benefit or a cost. I'm

Re: [go-nuts] retaining mapiterkey return values in *reflect.MapIter

2020-06-30 Thread Ian Lance Taylor
On Tue, Jun 30, 2020 at 6:39 PM 'Dan Kortschak' via golang-nuts wrote: > > Is there a reason not to retain the returned value from `mapiterkey` on > line 1243 of reflect/value.go[1] for use on line 1249[2]. > > ``` > // Key returns the key of the iterator's current map entry. > func (it *MapIter)

[go-nuts] retaining mapiterkey return values in *reflect.MapIter

2020-06-30 Thread 'Dan Kortschak' via golang-nuts
Is there a reason not to retain the returned value from `mapiterkey` on line 1243 of reflect/value.go[1] for use on line 1249[2]. ``` // Key returns the key of the iterator's current map entry. func (it *MapIter) Key() Value { if it.it == nil { panic("MapIter.Key called