For Kurtis:
If my idea is correct, then my question has been solved, thank you for 
replying.

在2020年11月11日星期三 UTC+8 下午12:16:26<Kurtis Rader> 写道:

> On Tue, Nov 10, 2020 at 7:57 PM 'Kilos' via golang-nuts <
> golan...@googlegroups.com> wrote:
>
>> For Dan:
>> I have an idea that the cause is in the runtime function mapiternext.
>> The runtime calls mapiternext function to choose next bucket to iterate 
>> by index,
>> if we put a key-value into a bucket which already be iterated, then the 
>> for-range will not iterate it again,
>> so the new key-value will not be printed.
>> But I don't know this idea is true or false.
>>
>
> Your idea (hypothesis) is basically correct. However, note that it doesn't 
> really matter that Go implements maps using a hash function and a 
> list+bucket data structure or another data structure (e.g., a tree). You 
> cannot safely iterate over a map, in any language, while concurrently 
> mutating the map unless the implementation explicitly says that is okay and 
> documents the semantics. Go expressly says you cannot expect predictable 
> behavior when doing so.
>
> -- 
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/140a9af1-c19c-448a-8846-2af923afdbb8n%40googlegroups.com.

Reply via email to