Duck typing is an application of the duck test, if it walks like a duck and it quacks like a duck then it must be a duck, to determine whether an object can be used for a particular purpose. The cited article contrasts it with nominative typing, in which an object is of a given type if it is declared as such or if the association is inferred through mechanisms such as object inheritance, whereas with duck typing an object is of a given type if it has all the methods and properties required by that type. It says duck typing may be viewed as a usage-based structural equivalence between a given object and the requirements of a type. Languages the atlas records as duck typed are grouped under this entry.
Connections
Typing Discipline Of Language
Sources
Duck typing (Wikipedia)
Lead section
In computer programming, duck typing is an application of the duck test-"If it walks like a duck and it quacks like a duck, then it must be a duck"-to determine whether an object can be used for a particular purpose.
In Group: Typing Disciplines, Lead
In computer programming, duck typing is an application of the duck test, "If it walks like a duck and it quacks like a duck, then it must be a duck", to determine whether an object can be used for a particular purpose.
View the SourceReader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.
Sign in to dispute this or suggest a correction.