Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Tips and Traps¶
Golang implements the type
Tuple
in the standard librarygo/types
, however,Tuple
is NOT a first class citizen in Golang.Multiple return parameters in Golang is implemented via
Tuple
in a limited way (sinceTuple
is not a first-class citizen).Tuple can only be used as multiple return parameters/values currently.
Since
Tuple
is not a first-class citizen, you cannot use aTuple
to receive multiple return values. Instead, you have to use define multiple variables to receive multiple return values.Nested types is NOT allowed as return parameters.
In [7]:
import "go/types"
In [8]:
types.Tuple
In [ ]: