duck typing

(redirected from Duck Type)

duck typing

(programming)
A term coined by Dave Thomas for a kind of dynamic typing typical of some programming languages, such as Smalltalk, Ruby or Visual FoxPro, where a variable's run-time value determines the operations that can be performed on it.

The term comes from the "duck test": if it walks like a duck and quacks like a duck, it must be a duck.

Duck typing considers the methods to which a value responds and the attributes it posesses rather than its relationship to a type hierarchy. This encourages greater polymorphism because types are enforced as late as possible.

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/100511.
This article is provided by FOLDOC - Free Online Dictionary of Computing (foldoc.org)

duck typing

In programming, assigning a type to a variable based on its contents. In other words, if it "walks like a duck and talks like a duck, etc." See typing.
Copyright © 1981-2019 by The Computer Language Company Inc. All Rights reserved. THIS DEFINITION IS FOR PERSONAL USE ONLY. All other reproduction is strictly prohibited without permission from the publisher.
References in periodicals archive ?
"We'll just be back to typical Oregon duck type weather - wet, cool and showery with storms coming through on a regular basis," said Dan Keirns, meteorologist with the National Weather Service in Portland.