Re: [go-nuts] Re: Will deleting a key from a map in an iteration prevent some keys being iterated in the same iteration?

2017-05-03 Thread T L
On Tuesday, May 2, 2017 at 10:07:11 PM UTC+8, Keith Randall wrote: > > Yes, all keys present in the map at the start of iteration, that aren't > deleted during iteration, will be returned during iteration. > Thanks for the clarification. > > On Monday, May 1, 2017 at 4:51:56 AM UTC-4, T L

Re: [go-nuts] Re: Will deleting a key from a map in an iteration prevent some keys being iterated in the same iteration?

2017-05-02 Thread 'Keith Randall' via golang-nuts
Yes, all keys present in the map at the start of iteration, that aren't deleted during iteration, will be returned during iteration. On Monday, May 1, 2017 at 4:51:56 AM UTC-4, T L wrote: > > > > On Monday, May 1, 2017 at 3:56:51 PM UTC+8, Paul Jolly wrote: >> >> I think the part of the spec

Re: [go-nuts] Re: Will deleting a key from a map in an iteration prevent some keys being iterated in the same iteration?

2017-05-01 Thread T L
On Monday, May 1, 2017 at 3:56:51 PM UTC+8, Paul Jolly wrote: > > I think the part of the spec you're after is under the heading: > https://golang.org/ref/spec#For_statements, specifically the sub-heading > of that link "For statements with range clause", specifically point 3 in > the

Re: [go-nuts] Re: Will deleting a key from a map in an iteration prevent some keys being iterated in the same iteration?

2017-05-01 Thread Paul Jolly
I think the part of the spec you're after is under the heading: https://golang.org/ref/spec#For_statements, specifically the sub-heading of that link "For statements with range clause", specifically point 3 in the enumerated list: *The iteration order over maps is not specified and is not

[go-nuts] Re: Will deleting a key from a map in an iteration prevent some keys being iterated in the same iteration?

2017-05-01 Thread T L
On Monday, May 1, 2017 at 3:50:11 PM UTC+8, T L wrote: > > for example > > for k, v := range m { > if SatisfySomeCondition(k, v) { > delete(m, k) > } > } > > will the above iteration guarantee to delete all k-v pairs from m? > will the above iteration guarantee to delete all k-v pairs