On Thursday, March 10, 2022 at 2:48:27 PM UTC+1 axel.wa...@googlemail.com 
wrote:

> On Thu, Mar 10, 2022 at 2:38 PM Manlio Perillo <manlio....@gmail.com> 
> wrote:
>
>> 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.
>>
>
> Also:
>
>> The scope of an identifier denoting a constant, type, variable, or 
>> function (but not method) declared at top level (outside any function) is 
>> the package block.
>
>
>
But this seems different from "The scope of a type identifier declared 
inside a function **begins** at the identifier in the ...".
My interpretation of the text you mentioned is: the identifier is **not** 
in scope **until** the type definition is complete.

Thanks
Manlio


>  
>
>>
>> > [...]
>>
>> 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...@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
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/aba04b1a-29a3-4950-8ba8-c4d6a4d9aa3en%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/43992fed-8c73-444d-aedc-19d549726896n%40googlegroups.com.

Reply via email to