-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
FrozenDueToAgeLanguageChangeSuggested changes to the Go languageSuggested changes to the Go language
Description
Go does not support contravariance, specifically
type Iterator interface {
Next() interface{}
}
is not satisfied by
func (s*WidgetList) Next() *Widget
---
Supporting contravariance would:
* Reduce the complexity of the language for the programmer (people assume things are
contravariant, covariance is more nuanced).
* Enable good collection classes to be implemented, which would likely either reduce the
need for generics or point the way.
* Should not be slower to compile than a call to Next().(*Widget). It may actually be
faster, by allowing better caching.
* Be reasonable in terms of implementation difficulty.
I couldn't find a bug tracking this, so I'm opening this one!Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeLanguageChangeSuggested changes to the Go languageSuggested changes to the Go language