Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
duck typing
// duck typing
final class Foo {
public function bar ($object) {
// Because we know nothing about $object, it's only by calling quack that we can
// tell whether object supports quack()
// Same but with a language construct that statically declares the need for $object
// to support a quack method. It could now be verified at compile time.
final class Foo {
public function bar ($object :: quack()) {

This comment has been minimized.

Copy link

commented Dec 1, 2016

@mathiasverraes Do other languages have this?

You can’t perform that action at this time.