Re: [go-nuts] Re: Struct members, hide or export?

2018-08-09 Thread Jay G
On Thu, Aug 9, 2018 at 8:14 PM Manlio Perillo wrote: > > > > On Thursday, August 9, 2018 at 9:50:55 AM UTC+2, Jay G wrote: >> >> Let's say I'm writing some library for internal usage in my project, what's >> the idiomatic way to design visibility of struct members? >> >> Option 1. export structs

[go-nuts] Re: Struct members, hide or export?

2018-08-09 Thread Manlio Perillo
On Thursday, August 9, 2018 at 9:50:55 AM UTC+2, Jay G wrote: > > Let's say I'm writing some library for internal usage in my project, > what's the idiomatic way to design visibility of struct members? > >- Option 1. export structs and members as much as possible. Only hide >ones that n

[go-nuts] Re: Struct members, hide or export?

2018-08-09 Thread snmed
Hi I would suggest to use the second option. If you export all possible members, you have to care on every redesign who and how this members are used. This makes a redesign unnecessarily tricky. Constructor functions are a common pattern in go code and therefore you should not flinch to use it.