News for hackers. Stuff that matters.
Re:Learning Go by porting a medium-sized web back end from P... by wybiral on Thursday November 09, 2017 @10:12AM (#15663023)
> That's not really true. If you want an SQL database to back your website, then you'll deal with interface{} with Go's sql package.

True. But for most real world scenarios I only ever use interfaces at the boundaries between APIs and they quickly get asserted into a type after being passed.

Conceptually they're a bit like passing marshalled data between APIs in that sense.

Re:Learning Go by porting a medium-sized web back end from P... by leetrout on Thursday November 09, 2017 @10:35AM (#15663225)
> Conceptually they're a bit like passing marshalled data between APIs in that sense.

That's IMHO a great way to think about when it's Good™ to use them. Yes, there are times when you just have to use the empty interface type but it's really not as bad as everyone makes it out to be.

I love Go because it is explicit and because explicit types make everything easier in the long run. I get tired of seeing Go written like Python/Ruby/$otherDynamicLang with overuse of interface{} and/or reflect.