type Color struct {
R, G, B, A byte // IDK
}
func (o OtherType) *Color {
return &Color{R: o.r, B: o.b, G: o.g}
}
type Colorer interface {
func Color() *Color
}
A colorer would return a color regardless of its type. This is behavior-based interface. I just need a thing that when I call Color(), you get a *Color.
That's not an enum or sum type, though, and misses the point of my example. For colors, sure, you can use a structural type to represent RGBA, but that wasn't what I was trying to get across. What if the set of possible values cannot be described as scalars? The other example with "actions" demonstrated this problem.