News for hackers. Stuff that matters.
Re:Is Go Duck-Typed? by samatman on Wednesday March 04, 2020 @05:27PM (#22488831)
I agree, and the difference is easy to illustrate.

quack() in duck typing, has to have no arguments and return a string (let's say). We can have a NotarizedDuck class where quack(true) instead returns the number of times the NotarizedDuck has quacked, so long as quack() itself returns a string, it will pass the unit test.

In structural typing, it's illegal to call that quack, because it's the wrong function signature.

There are no comments on this comment yet.