All about interface values: common patterns and type analysis
concrete type (int etc)
concrete interfaces (“container”)
empty interface (use only if there’s no oter way)
Sum Types / Tagges interfaces
example:
type Go struct{}
type Js sctruct{}
func (Go) isLanguage() {}
func (JS) isLanguage() {}
type Lang interface {
isLanguage()
}
func main() {
var lang Lang
lang = "string" // Error, yay!
}
Issues:
verbose
nil
Not exhaustive pattern matching / type switch (e.g. switch lang.(type) )