Go updates may delight diehard gophers but displease AI overlords

https://image.theregister.com/5290671.jpg?imageId=5290671&x=0&y=0&cropw=100&croph=100&panox=0&panoy=0&panow=100&panoh=100&width=1200&height=683

v 1.27 expands generics to support methods

The keepers of the Go programming language on Wednesday released the latest version, v1.27, and with it come considerable advances in generics.

In a nutshell, generics allow developers to write logic where data types are treated as variables, eliminating the need to rewrite (or copy and paste) a separate method for each different data type (int, string, floating point, etc.). It was "absolutely barbaric," noted one YouTube tutorial creator.

Go introduced generics for both functions and custom data types in version 1.18, released in 2022.

The v1.27 release expands generics to support methods, which are basically just functions that are bound to a data type. These new generics will save a lot of typing, at least if the programmer has some chops.

Golang’s standard random number generator, for example, can produce either a 32-bit integer (int32), 64-bit integer (int64) or...

Copyright of this story solely belongs to theregister.com. To see the full text click HERE

Read more