Category: Google|Jun 28, 2020 | Author: Admin

google's go language could get generics in 2021

Share on

Generics have been requested by Go programmers for years for the simplicity and flexibility they offer

Generics have been requested by Go programmers for years for the simplicity and flexibility they offer

Developers of Google’s Go language are moving forward with plans to introduce generics into the language, with the capability potentially arriving in August 2021, if all goes well. The lack of generics, meaning a function or type that takes type parameters, frequently has been cited as a shortcoming of Go. 

Generics would be included in the Go 1.17 release, due at that time. But that timeline was described as optimistic by Go project developers, who noted unforeseen problems could arise. Generic programming enables the representation of data structures and functions in a generic form, with types factored out. It has been viewed as a mechanism to make some programming tasks simpler but there have been concerns that it could complicate the language.

[ Also on InfoWorld: 10 open-source projects proving the power of Google Go ]
Go project developers on June 16 released an updated design draft for type parameters that replaces contracts with interface types. They also introduced a transition tool to help to translate generic code. The design draft authors found that the difference between contracts and interface types was confusing, so they dropped the contracts plan. Type parameters are now constrained by interface types, while interface types now can include type lists, though only when used as constraints. Authors of the updated draft hope developers will find it easier to understand.

The transition tool, available in a variant of the Go Playground, permits type checking and running code written using the version of generics described in the draft. The transition tool is intended to help the Go language developers decide how to further refine the draft; the tool translates generic code into Go code. While the translation process has limitations, Go’s developers hope the tool provides a glimpse of what generic Go code might look like and learn whether generic code makes sense. 

The next step for generics in Go could be a formal language change proposal. Go’s developers are in the early stages of sketching out a direct compiler implementation. Also, the Go project developers have written a type checker, a program that can parse Go code that uses generics as described in the draft and report type errors. An example code has been written.

Go originally was released in November 2009. Go 1.15 was released in beta form last week. The production release of Go 1.15 is expected in August.

Sponsored Ads:

Comments:


iOS 15-hole leaked private Apple ID data to third-party apps

Category: Apple|Jan 21, 2022 | Author: Admin

Had to crisis-postpone new 5G standard in the US to avoid plane chaos

Category: IT|Jan 20, 2022 | Author: Admin

No one found out that the iPhone 13 is missing this until now

Category: Apple|Jan 19, 2022 | Author: Admin

Safari leaks your browser history

Category: General|Jan 18, 2022 | Author: Admin

Chromium Trouble - Can't change default search engine anymore

Category: Google|Jan 17, 2022 | Author: Admin

Here, developers are allowed by Apple to offer alternative payment methods

Category: Apple|Jan 16, 2022 | Author: Admin

Microsoft refuses to correct the error - took matters into its own hands

Category: Microsoft|Jan 15, 2022 | Author: Admin

Now Meta gets the authorities on its neck, again

Category: General|Jan 14, 2022 | Author: Admin

Has invested heavily in podcasts - now Spotify is closing down the studio

Category: General|Jan 13, 2022 | Author: Admin

Claims HomePod mini is on its way to Norway

Category: General|Jan 12, 2022 | Author: Admin

Linux gets the function everyone wants

Category: IT|Jan 11, 2022 | Author: Admin

Flasher RTX 3080 Ti with 3090 BIOS for extra efficient Ethereum mining

Category: General|Jan 10, 2022 | Author: Admin

Dice continues to destroy for himself: removed favorite from Battlefield 2042

Category: General|Jan 9, 2022 | Author: Admin

NBN Co applies fix to get hundreds of Sky Muster satellite services back online

Category: IT|Jan 8, 2022 | Author: Admin

You can trick Windows 11's new media player

Category: Microsoft|Jan 7, 2022 | Author: Admin
more