Tech »  Topic »  Approved proposal reverses earlier stance, even as survey highlights bigger frustrations

Approved proposal reverses earlier stance, even as survey highlights bigger frustrations


The Go team has approved generic methods, reversing a longstanding position in the language's FAQ. The proposal, from Go co-designer Robert Griesemer, now moves to implementation.

A key issue – that Go interfaces cannot include generics – will remain. The earlier view was that since generic methods cannot implement interfaces, there was no point in having them. Developers could simply code generic functions, which already exist. The change of view is that methods are useful for organizing code even if they do not implement an interface, so there is no reason not to have them support type parameters – generics – in the same way as functions.

Griesemer said that the new feature is fully backward-compatible with existing Go code, though tools will need to catch up. The interface issue remains, though, and Griesemer added that providing generic methods "doesn't preclude the implementation of generic interface methods at some point, should we ...


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