DEV Community

Freedom
Freedom

Posted on

Go 1.14 Overlapping Interfaces

What is the usefulness or change you will benefits from overlapping interfaces which will be release in Go 1.14?

https://github.com/golang/proposal/blob/master/design/6977-overlapping-interfaces.md

Top comments (1)

Collapse
 
different55 profile image
Different55 • Edited

Finally can write this audio visualizer toolkit the way I wanted to. I wanted to do it like

type Node struct {
    Start() // Does any necessary startup tasks, mostly launching a
            // goroutine to handle input and output in the background.
}

// Outputs information
type Source struct {
    Node
    ConnectOutput(Sink) // Connects this source's output to a Sink's input
}

// Consumes information
type Sink struct {
    Node
    ConnectInput(Source) // Connect this sink's input to a Source's output
}

// Consumes and outputs information.
type Pipe struct {
    Node
    Source
    Sink
}

Before, I can't remember what I had to do to work around it, but I ended up just giving up on the project. Sounds like it'll be time to pick it back up soon.