News for hackers. Stuff that matters.
Re:The Value in Go’s Simplicity by lowmagnet on Saturday November 16, 2019 @04:27PM (#21555061)

  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.
Re:The Value in Go’s Simplicity by atombender on Saturday November 16, 2019 @07:14PM (#21555765)
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.