This code compiles fine package main
type node struct { next *node } func main() {} (https://play.golang.org/p/ZYg0EciQnOQ) This code does not package main type node = struct { next *node } func main() {} (https://play.golang.org/p/gWWX8ngPsS6) The error is prog.go:3:6: invalid recursive type alias node prog.go:3:6: node uses <T> prog.go:3:13: <T> uses node The specification remains silent about what is considered "invalid recursive type alias" so I'm not sure, but it seems to me the first and second programs should both compile fine. In both cases, so to say "the pointer breaks the cycle" while type checking. But maybe/probably I'm mistaken. Can anybody enlighten me please and explain if the compiler is right or if it's a bug? Thanks in advance. -- -j -- 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.