Just to be clear, the way I understood you is that you want HtmlTree.C to be a slice which has elements which can each either be a string or an *HtmlTree - i.e. you wan these to be mixed in a single slice. Correct? Because that is not a use case for generics, it's a use case for sum types (which Go does not have).
On Mon, Dec 20, 2021 at 4:11 PM Michael Ellis <michael.f.el...@gmail.com> wrote: > > They can't, sorry. > Ok. Thanks, Axel. > Saves me wasting more time. In the past 3 years of using Go, this is the > only use case where I've really wanted generics (other cases I've > encountered so far are easily handled with code generation). > > -- > 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/ac75dc32-733d-4a73-9735-619c33cb4cd4n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/ac75dc32-733d-4a73-9735-619c33cb4cd4n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAEkBMfEQH4aBzXFFyKvyXo8b6pbdGHa-6Ueughffasq4mWCpNQ%40mail.gmail.com.