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 enumerated list:
>
> *The iteration order over maps is not specified and is not guaranteed to 
>> be the same from one iteration to the next. If map entries that have not 
>> yet been reached are removed during iteration, the corresponding iteration 
>> values will not be produced. If map entries are created during iteration, 
>> that entry may be produced during the iteration or may be skipped. The 
>> choice may vary for each entry created and from one iteration to the next. 
>> If the map is nil, the number of iterations is 0.*
>
>
>
>
>
The guarantee I need is *every map entries created before the iteration 
will be reached if it is not removed even if some entries are removed in 
the iteration*.
Looks this is silly. :) The answer should be yes I think.
 

>
> On 1 May 2017 at 08:51, T L <tapi...@gmail.com <javascript:>> wrote:
>
>>
>>
>> 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 satisfying a 
>> condition from m?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to