I think if you opened a proposal it would be merged into the generics discussion: https://github.com/golang/go/issues/15292
There may be other ways to write the program, can you provide a concrete example of where you’ve needed this? Matt On Wednesday, April 18, 2018 at 9:13:59 AM UTC-5, Sakthi Natesan wrote: > > Go supports below type assertion <https://tour.golang.org/methods/15> > > t := i.(T) > and > t, ok := i.(T) > > Can this feature be extended to array of interfaces as mentioned below? > > t := i.([]T) > and > t, ok := i.([]T) > > > I have been using Golang for almost four years and I have come across use > cases requiring this feature many times. So far, I write a function for > each specific case which clones the array into new array with type asserted > to new type. I repeat the same pattern of assertion for array of different > types and perform extra array copy each time I assert. Is there a better > alternative solution with existing Go feature or Is there a chance that > this feature will be supported in future? > > sample code <https://play.golang.org/p/-Flgqk9qbJD> > -- 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.