News for hackers. Stuff that matters.
Re:On Go by rogpeppe1 on Wednesday June 05, 2013 @01:12PM (#5827016)
i usually do something like this instead:

  type Config struct {
    a int
    b string
    c float
    d interface{}
  }

  var defaultConfig = Config{
     a: 11,
     b: "some default",
     c: 55.5,
     d: new(D),
  }

  func f(cfg Config) {
      // ...
  }

  func main() {
     cfg := defaultConfig
     cfg.c = 44.4
     f(cfg)
  }
having the "keyword" arguments as a separate type makes them potentially useful as a currency to pass to other functions too, rather than as a set of attributes and values defined for one function only.

There are no comments on this comment yet.