4 ms·
This is probably because Go doesn't allow function overriding. You can't have `streamFromUrl(foo)` and `streamFromUrl(foo, bar)`, so you end up with `streamFrom
by thomascgalvin 4y ago
This is probably because Go doesn't allow function overriding. You can't have `streamFromUrl(foo)` and `streamFromUrl(foo, bar)`, so you end up with `streamFromUrlWithFoo(foo)` and streamFromUrlWithFooAndBar(foo, bar)`.
- deleted 4y ago[deleted]
- everybodyknows 4y agoConsider variadic arguments for such cases.
- sidlls 4y agoThere is a group of developers where I work who would take a perfectly fine `New(…*Options)` constructor and write a whole suite of “option wrapper” “utilities” around it, rather than expose that function. It makes me tear up a little (not in a good way).
- sidlls 4y agoNo doubt: and that is generally the pattern I’ve seen. It’s really an eyesore.
- euroderf 4y agoRight. It's kosher to have one simple "New(..)" function per package, for the key type in the package, but all the other constructors shall have verbose names.