On Fri, Jul 7, 2017 at 12:05 PM, peterGo <go.peter...@gmail.com> wrote:
> Perhaps it's like packages fmt and log: a default output and a user defined
> output. For example fmt.Print, fmt.Fprint.

I'm starting to think I'm overthinking this (no idea why I'm hung up
on this one particular weird API issue) and I should just go with the
method that best encodes the behavior I want in the type system, which
is just having two functions. I forgot to mention the relatively
important fact that there is a somewhat sane default behavior I can
use if a callback isn't provided, so having two functions (where the
no-argument variant is just calling the other one with a nil function
which falls back to that default) makes sense, even if it does
increase the API surface and means you have to look in two places in
the docs.

More opinions on the best way to do this would still be welcome, of
course. Thanks!

—Sam

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to