From 85dcc34e0dad613f7f7d0915a52bdacedd570c3a Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor
+Covariant result types would mean that an interface like + +
+type Copyable interface { + Copy() interface{} +} ++ +would be satisfied by the method + +
+func (v Value) Copy() Value ++ +because
Value
implements the empty interface.
+In Go method types must match exactly, so Value
does not
+implement Copyable
.
+Go separates the notion of what a
+type does—its methods—from the type's implementation.
+If two methods return different types, they are not doing the same thing.
+Programmers who want covariant result types are often trying to
+express a type heirarchy through interfaces.
+In Go it's more natural to have a clean separation between interface
+and implementation.
+
+