The following playground example shows the problem:

https://go.dev/play/p/1kC2j57M_fW


Le 15/06/2023 à 10:28, Jan Mercl a écrit :
On Thu, Jun 15, 2023 at 10:16 AM christoph...@gmail.com
<christophe.mees...@gmail.com> wrote:

It is possible to define two structures globally with mutual type dependency as 
this:

type A struct {
     B []B
}

type B struct {
     A A[]
}

but I just noticed that we can't do that inside a function:

func Foo() {
     type A struct {
         B []B
     }

     type B struct {
        A A[]
     }
}

Is there a reason for this limitation ?
Syntax error: https://go.dev/play/p/ZOGyZyQDW0I

--
Bien cordialement,
Ch.Meessen

--
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/801e7e6b-d3f8-c1df-8eae-46aa619d49a5%40gmail.com.

Reply via email to