Difference between revisions of "Duck typing"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(Created page with "In computer programming, duck typing is an application of the duck test in type safety. It requires that type checking be deferred to runtime, and is implemented by means of d...")
 
Line 1: Line 1:
In computer programming, duck typing is an application of the duck test in type safety. It requires that type checking be deferred to runtime, and is implemented by means of dynamic typing or reflection.
+
In [[computer programming]], '''duck typing''' is an application of the duck test in type safety. It requires that type checking be deferred to runtime, and is implemented by means of dynamic typing or reflection.
 +
 
 +
== Description ==
 +
 
 
Duck typing is concerned with establishing the suitability of an object for some purpose. With normal typing, suitability is assumed to be determined by an object's type only. In duck typing, an object's suitability is determined by the presence of certain methods and properties (with appropriate meaning), rather than the actual type of the object.[citation needed] The analogy to the duck test appeared in a Python Enhancement Proposal discussion in 2002.
 
Duck typing is concerned with establishing the suitability of an object for some purpose. With normal typing, suitability is assumed to be determined by an object's type only. In duck typing, an object's suitability is determined by the presence of certain methods and properties (with appropriate meaning), rather than the actual type of the object.[citation needed] The analogy to the duck test appeared in a Python Enhancement Proposal discussion in 2002.

Revision as of 12:16, 29 November 2016

In computer programming, duck typing is an application of the duck test in type safety. It requires that type checking be deferred to runtime, and is implemented by means of dynamic typing or reflection.

Description

Duck typing is concerned with establishing the suitability of an object for some purpose. With normal typing, suitability is assumed to be determined by an object's type only. In duck typing, an object's suitability is determined by the presence of certain methods and properties (with appropriate meaning), rather than the actual type of the object.[citation needed] The analogy to the duck test appeared in a Python Enhancement Proposal discussion in 2002.