Thanks!  Yes, let's do that :)

On Thursday, September 12, 2019 at 6:28:02 PM UTC-4, Ian Lance Taylor wrote:
>
> On Thu, Sep 12, 2019 at 2:02 PM Nate Finch <nate...@gmail.com 
> <javascript:>> wrote: 
> > 
> > I wish go's type inference worked inside struct literals. Filling out 
> config structs would be so much easier if this worked: 
> > 
> > type Config struct { 
> >   Runtime struct { 
> >      Debug bool 
> >   } 
> > } 
> > c := Config{ 
> >   Runtime: { 
> >     Debug: true, 
> >   }, 
> > } 
> > 
> > ^^ why can't this work?  It seems unambiguous. 
> > 
> > The initial Config{ defines the type and tells the compiler exactly what 
> everything inside it must be.... 
> > 
> > The reason that I wrote the struct that way is that it makes it very 
> easy to read when the struct gets bigger. The sub-structs become basically 
> just namespaces on the fields they encompass.  But if you then have to 
> write a literal by redefining the struct, the literal becomes impossible to 
> read 
> > 
> > 
> > c := Config{ 
> >   Runtime: struct { Debug bool }{ 
> >     Debug: true, 
> >   }, 
> > } 
>
> I think you may be looking for https://golang.org/issue/21496. 
>
> Ian 
>

-- 
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/adaa2a60-b5e9-4e1c-b62b-2b171483f365%40googlegroups.com.

Reply via email to