14 ms·
Honestly asking what "generics" offers over passing and handling interface{}. func myBlah(thing interface{}){ switch thing.(type) { case int:
by utahcon 7y ago
Honestly asking what "generics" offers over passing and handling interface{}.
func myBlah(thing interface{}){
switch thing.(type) {
case int:
// handle my int
case string:
// handle my string
default:
// default handling
}
}
- cjslep 7y agoSee [0] which is a code generated piece of the ActivityStreams spec. As it is RDF based, it is an open ended set. Not worth doing by hand. [0] https://github.com/go-fed/activity/blob/master/streams/gen_type_resolver.go https://github.com/go-fed/activity/blob/master/streams/gen_t...