Hacker News new | ask | show | jobs
by azth 3768 days ago
Interfaces in golang are error prone. It's easy to inadvertently implement an interface you didn't mean to. It's also difficult without the aid of some tooling, to determine which set (or whether at all) of interfaces a given structure implements.

There was a blog post a while ago about how golangs's interfaces caused issues in production because they're implicit.

Check out type classes for a superior way to solve this issue (e.g. what Scala or Rust do).

1 comments

I can't think of a problem caused by inadvertently implementing an interface?
Client code relying on the fact that your class implements that interface when it wasn't intentional and might change perhaps?