On Thursday, March 10, 2022 at 2:04:44 PM UTC+1 Jan Mercl wrote:

> On Thu, Mar 10, 2022 at 1:40 PM 'wagner riffel' via golang-nuts <
> golan...@googlegroups.com> wrote:
>
> > 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.
>
> The validity of `type T *T` in Go is based on two things: 1) The 
> visibility of the identifier in `type T ...` is specified to start right 
> after the identifier, 2) It's possible, in this case, to compute the size 
> of type T. So no problem here.
>
>
The only reference I found in the spec (after a quick search) is:
    8. The scope of a type identifier declared inside a function begins at 
the identifier in the TypeSpec and ends at the end of the innermost 
containing block.

> [...]

Thanks 
Manlio

-- 
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/aba04b1a-29a3-4950-8ba8-c4d6a4d9aa3en%40googlegroups.com.

Reply via email to