Hi. I have a generic function func slicerG[A any](s []A, i int) []A { fmt.Println(len(s), i) if i > len(s) { return s } return s[0:i] }
When I try to register this in a template's FuncMap, it fails with "cannot use generic function slicerG without instantiation" https://go.dev/play/p/KpvrbbcTaM2 I guess this makes sense if the compiler is converting the function to function variants of particular types based on instantiation, but is there any way around this? Thanks, Rory -- 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/ZAZelXNTAEaXy0cs%40campbell-lange.net.