Go 1.19 programming language adapts its memory model to C, Java and Rust

0
32
go 119 programming language adapts its memory model to c.jpg
go 119 programming language adapts its memory model to c.jpg

The update to Go 1.19 improves the generics and aligns the memory model more closely with the definitions in C, C++, Java, JavaScript, Rust and Swift.

 

The Go development team has released version 1.19 of the programming language. According to the announcement, a number of performance and implementation improvements have been incorporated into the new release, including the generics that were only officially released in Go 1.18. The Go team has also aligned the memory model more closely to the memory models of common programming languages ​​such as C, Java and Rust in some points.

 

The most important innovation in the previous release was the introduction of generics – a feature that has been established in numerous languages ​​and that Go developers were denied for a long time. To avoid the complexity associated with generic programming, the Go designers originally avoided using generics.

Generic data structures such as lists, graphs or tree structures therefore had to be implemented again and again up to Go 1.18 for each specific data type that they were to manage, instead of being able to assign the type later on. With the release of Go 1.19, developers can not only hope for performance increases when using generics – the Go team speaks of a plus of up to 20 percent – but also various questions and problems reported by the community should have been worked through.

The makers behind the language, which goes back to Google, have also revised the Go memory model. Specifically, the behavior of the sync/atomic package was specified more clearly for the update to version 1.19. The definition of the happens-before relation has been aligned with that of the memory models of C, C++, Java, JavaScript, Rust and Swift – however, existing Go programs should remain unaffected. Additionally, to simplify the use of atomic values, the Go team updated the sync/atomic package with new types such as atomic.Int64 and atomic.Pointer[T] added.

SEE ALSO  OPPO's most recent mid-range comes with a surprise: the company gives away headphones with your purchase

Other innovations in Go 1.19 concern the documentation, in particular the Doc Comments. In order to facilitate navigation within the comments and thus also to support Go developers in writing clearer code, links and lists can be added to Doc Comments in the future. A clearer syntax is also provided for headings. Existing comments can be added gofmt reformat and adapt for the new functions. More details about the changes can be found in the documentation.

The announcement on the official The Go blog provides a complete overview and additional information about all the innovations in Go 1.19.