On Thu Mar 10, 2022 at 12:41 PM CET, Manlio Perillo wrote: > Interesting example, thanks. > > But how does `type self *self` works? If I remember correctly, it is not > discussed in the Language Specification and in The Go Programming Language > book. >
I don't think it's mentioned in the specification, my bet is that unless your type requires inifnity amout of memory (eg: `type t struct {t}`) or the type is an interface and break its rules, (eg: `type iface interface{ iface }`) you can use self-reference. > By the way, in C `typedef self *self` is invalid (assuming my code is > written correctly). You're correct, C doesn't allow self reference in type decl, more interesting types beside pointers: `type fn func() fn` `type s []s` `type ch chan ch` `type m map[*m]m` -w -- 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/CIG6Z0BDF5P1.1O1MIIQNEHEZY%40pampas.