Hacker News new | ask | show | jobs
by btown 4294 days ago
The fact that a modern language encourages developers to do something like

``` func (self Gok) SetCookie_4(name string, value string, duration int64, urlPath string){ ... } func (self Gok) SetCookie_5(name string, value string, duration int64, urlPath string, domain string) { ... } func (self *Gok) SetCookie_7(name string, value string, duration int64, urlPath string, domain string, secure bool, httpOnly bool) { ... } ```

is simply baffling to me.

1 comments

In this particular example, they don't. They encourage you to define a Cookie struct, construct it with all the fields you know, pass it to the method with gok.SetCookie(Cookie{name: "blub", duration: 5000}) and the method should decide what to do based on the fields available