Value-Oriented Programming
As someone who mostly develops in Go these days, I have envy of languages like Rust, Swift, OCaml and Haskell where &quot;value-oriented programming&quot; actually have rich language support.<p>In particular, &quot;value types&quot; are really useful for ASTs, configurations and other DSLs where you have graphs of polymorphic values.<p>For this, you really need sum types (often called tagged unions or enums), as illustrated in the article. In Go, the absence of a sum type mechanism means you have to use interfaces as a kludge. In a current project we have something like this:<p><pre><code>  type Expr interface {
    isExpr()
  }

  type Identifier struct {
    Name string
  }
  func (Identifier) isExpr()

  type FuncCall struct {
    Name string
    Args []Expr
  }
  func (FuncCall) isExpr()

  &#x2F;&#x2F; ...
</code></pre>
instead of something like:<p><pre><code>  type Expr enum (
    Identifier struct {
      Name string
    }
    FuncCall struct {
      Name string
      Args []*Expr
    }
  }
</code></pre>
One annoyance in Go is that the compiler can&#x27;t prove that your type switches are exhaustive, but there are other downsides, such as that all values must be boxed inside an interface.