Re: [go-nuts] Why is type inference still so rudimentary?

2023-08-04 Thread jimmy frasche
I wish there were more cases where the types could be elided. Always leaving it off would be a bad idea but how much to put in should be at the author's discretion. There are times when it clarifies but more times when it just adds extra steps. I know that the current rules have justifications but

Re: [go-nuts] Why is type inference still so rudimentary?

2023-08-04 Thread Ian Lance Taylor
On Fri, Aug 4, 2023 at 8:08 AM Nate Finch wrote: > > If I have a struct > > type User struct { > Name string > ID int > } > > type Group struct { > Leader User > } > > Why is it that the go tool can't infer what type I'm constructing for the > Leader field here? > > g := Group{ >

[go-nuts] Why is type inference still so rudimentary?

2023-08-04 Thread Nate Finch
If I have a struct type User struct { Name string ID int } type Group struct { Leader User } Why is it that the go tool can't infer what type I'm constructing for the Leader field here? g := Group{ Leader: { Name: "Jamie", ID: 5, }, } Cleary, the