Get the latest tech news

Duck typing (horror) in Go


If you say Go supports “duck typing” online, you’ll probably get somepushback. The Go community often points out that Go doesn’t support duck typingbecause i...

Rather, Go has “structural typing” where interfaces are still implicitly implemented, but still checked at compile time. It is essentially the Go analogue of the Wikipedia duck typing example in Python. Of course, the “correct” implementation of the quack function would be to accept Duck instead of any and ditch the type assertion, which will result a compile time error:

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Horror

Horror

Photo of Duck Typing

Duck Typing

Related news:

News photo

Starfield Shattered Space warps Bethesda's final frontier into full-on horror

News photo

What to read this week: An astronaut’s journey and queer horror that bites back at cliché

News photo

Hellblade II’s stunning world is alive with horror