This is the first day of my participation in Gwen Challenge
Why are map operations of Go not defined as atomic operations?
After a lengthy discussion, we decided that regular use of MAPS did not require concurrency safety for multiple coroutines. When it comes to multi-coroutine concurrency security, the map is often part of a larger data structure or computation process that has long been synchronized locked. Therefore, requiring all map operations to acquire a mutex first would slow down most applications in exchange for a small security gain. This was not an easy decision, because it meant that uncontrolled map design could cause the program to crash.
Later versions of Go do not exclude atomic map implementation. Some methods can implement map access when needed, such as when running untrusted code.
Map insecurity only occurs when a map is updated. As long as all coroutines are reading a map or traversing the map with a for-range without allocating or deleting elements of the map, then concurrent operations on the map are not considered synchronous locks and are safe.
To help users detect map errors, the Go language implements methods that alert users to possible concurrency issues when updating a map.
Preclude, preclude, precludeCopy the code
Would you like to experience the Go language?
People have made many suggestions to improve Go, such as groups.google.com/forum/#! The for…
Although Go is an open source project, both the language and the library are “golang.org/doc/go1comp… The specification of 1, even if the value is good, we will not be satisfied and accept. Some major future versions of Go may not be compatible with Go 1, but one thing is for sure: there will be very few incompatibilities. In addition, in order to ensure compatibility, we will provide a way for older applications to work with the new version of Go, and these are under discussion.
Even if your proposal is compatible with Go 1, but does not fit with the design spirit of Go, it will not be accepted. Talks.golang.org/2012/splash…
Proposal N violate specification n Violate the ways that entertain v. Gratified, incompatible Moreever besidesifEven if theCopy the code