You might want to reconsider your use of Go if the lack of generics hinders your productivity. Code generation, IDE macros and other tricks do not solve this problem. Sometimes go is just not the right tool for the job. D has generics and solid concurrency primitives.
Le vendredi 10 mars 2017 09:35:45 UTC+1, hui zhang a écrit : > > And pls don't tell me interface{} is good , can solve your problem bla bla > bla > when interface{} meet slice > []int --> []interface{} , > all generic can not be done > > 在 2017年3月10日星期五 UTC+8下午4:29:20,hui zhang写道: >> >> >> >> I want to generate a min func >> >> func Min(a,b T) T { >> if a < b { >> return a >> } else { >> return b >> } >> } >> >> >> pls generate below, pls use go generate to generate int int64 int32 >> int16.... uint64 uint32 .... float32 float64 >> Pls do not just paste documents. There is a lot on google. but none of >> them explain it clearly >> Just tell me how to do the below things generate by demo. >> >> >> func MinInt32(a,b int32) int32 { >> if a < b { >> return a >> } else { >> return b >> } >> } >> >> func Minint(a,b int) int { >> if a < b { >> return a >> } else { >> return b >> } >> } >> >> func Minfloat32(a,b float32) float32 { >> if a < b { >> return a >> } else { >> return b >> } >> } >> >> >> ............ >> >> >> >> >> >> >> >> -- 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. For more options, visit https://groups.google.com/d/optout.