[go-nuts] Re: Is it acceptable to make the optional parameter as varargs

2020-05-29 Thread bojanz
I actually published a whole article listing the various patterns for optional parameters, just a few hours ago: https://bojanz.github.io/optional-parameters-go/ Your code looks fine to me, it is a reasonable tradeoff. On Monday, May 25, 2020 at 4:59:00 AM UTC+2, Amarjeet Anand wrote: > > Is

Re: [go-nuts] Re: Is it acceptable to make the optional parameter as varargs

2020-05-25 Thread Robert Engels
You can use builder to build options or the server. It is a much cleaner and self documenting method. > On May 25, 2020, at 12:51 PM, sergey@netdata.cloud wrote: > >  > Hello Amarjeet, > > You can actually don't check if len(options) is greater than one – if your > package provides only

[go-nuts] Re: Is it acceptable to make the optional parameter as varargs

2020-05-25 Thread sergey
Hello Amarjeet, You can actually don't check if len(options) is greater than one – if your package provides only single implementation of Option, than there is no way to pass something different than that backoffOption. But it also brings an ability to extend your constructor later. There is a