There's an advantage though, for rather narrow cases though: reuse of interfaces:
https://go2goplay.golang.org/p/HJr3QIzgQuX среда, 17 июня 2020 г., 19:58:08 UTC+3 пользователь Denis Cheremisov написал: > > IMO a groups of constraints are horrible with interfaces > > type CommonResponse(type E) interface { > GetError() E > } > > type CommonError interface { > GetCode() int32 > } > > func IsOK(type R CommonResponse(E), E CommonError)(r R) bool { > switch r.GetError().GetCode() { > case 0, 200, 201: > return true > default: > return false > } > } > > vs > > constract CommmonResponse(R, E) { > R GetError() E > E GetCode() int32 > } > > func IsOK(type R, E CommonResponse)(r R) bool { > switch r.GetError().GetCode() { > case 0, 200, 201: > return true > default: > return false > } > } > > That trickery with commas to express dependcy of types is hard > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/a93996df-d66c-4fd2-85a8-3a7e9d709050o%40googlegroups.com.