If it walks like duck and quacks like a duck

Duck-Typing is a concept of exhibiting a certain behavior (implementing an interface, following a protocol).

If an object behaves in a certain way it could be considered as a good-enough duck.

This is how groups, societies and organizations work (separation of concerns and qualification).

What it takes to be a…

To be a.. is to implement a certain set of functions (an interface) or to follow a certain protocol, which is an interface plus a set of formally defined rules or "laws".

Substituting of equivalent for an equivalent

In molecular biology the exactly same molecular structure (not a copy, but a part of a larger one) could be "used" as an equivalent.


An implementation of an interface allows an object to be substituted (used) in place of other object.

Composable behaviors.


The canonical example is Iterators. It is a standardized within a language duck-typed interface - a protocol. Everything which implement the interface (protocol) becomes Iterable and could be used everywhere an Iterable could be used - looping constructs, conditionals, high-order procedures, etc.

Another example are ranges, slices, etc.

Last modified 15 months ago Last modified on Nov 18, 2018, 5:14:05 AM
Note: See TracWiki for help on using the wiki.