logoalt Hacker News

gf000last Wednesday at 10:26 AM1 replyview on HN

I don't see what go's interfaces have to do with the first two. It's just structural typing, isn't it?


Replies

spoilerlast Wednesday at 11:24 AM

I think one of those pedagogical half-truths useful for onboarding people onto an idea across different languages or getting parts of a point across, and they cover some similar use-cases.

It's a bit like saying JavaScript's prototypes are classes even though they're technically not (even with the introduction of the `class` syntactic sugar), but for casual discussions it's probably fine to just say "JS class".

But to your point: I wouldn't really phrase the way the GP did; it makes it seem like they're on the same level of usefulness as a type class!