Scala Design Patterns.
上QQ阅读APP看书,第一时间看更新

Duck typing

This is a feature that is available in Scala and is similar to what some dynamic languages provide. It allows developers to write code that requires the callers to have some specific methods (but not implement an interface). When someone uses a method with a duck type, it is actually checked during compile time whether the parameters are valid.