News for hackers. Stuff that matters.
Re:Sum Types in Go by dons on Friday December 26, 2014 @04:33AM (#8798535)
They may not be recursive however
Re:Sum Types in Go by panic on Friday December 26, 2014 @05:15AM (#8798582)
You can work around that using a "Box" type that wraps a value in a reference:

    class Box<T> {
        var contents : T
        init(_ initialContents : T) {
            contents = initialContents
        }
    }

    enum BinaryTree {
        case Leaf
        case Branch(Box<BinaryTree>, Box<BinaryTree>)
    }