Yes indeed! These constructions all give us *expressions *with many consecutive stars. But they don't give us *types *with that. (and you can't assign a *Number to a **Number, for example)
On Tue, Mar 15, 2022 at 11:50 AM Jan Mercl <0xj...@gmail.com> wrote: > On Tue, Mar 15, 2022 at 4:41 PM Thomas Bushnell BSG > <tbushn...@google.com> wrote: > > > Not in the normal implementation it doesn't. Typically it might be: > > > > type element struct { > > value int > > next *element > > } > > > > next is a pointer to an element, not a pointer to a pointer. That > element contains within it a pointer, but next is not a pointer to a > pointer. If it were, it would be declared with two stars. > > Although linked lists usually do contain a payload, as you note, I > consider `type peano *peano` a payload-less linked list. Or a linked > list with zero sized payload one could also say. And once a node > contains zero bits of a payload, it contains only the link field. And > a struct with a single field is another interesting case that can be > abstracted out. Numbers 0 and 1 make many things much more interesting > ;-) > -- 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/CA%2BYjuxuzz1tMi2vT0oUmyyE8YA9Q31x054pXf_zY0XHRsLjQsw%40mail.gmail.com.