KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Wikipedia used to say* about duck-typing : In computer programming with object-oriented programming languages, duck typing is a style of dynamic typing in which an object's current set of methods and properties determines the valid semantics, rather than its inheritance from a particular class or implementation of a specific interface. (* Ed. note: Since this question was posted, the Wikipedia article has been edited to remove the word "dynamic".) It says about structural typing : A structural type system (or property-based type system) is a major class of type system, in which type compatibility and equivalence are determined by the type's structure, and not through explicit declarations. It contrasts structural subtyping with duck-typing as so: [Structural systems] contrasts with ... duck typing, in which only the part of the structure accessed at runtime is checked for compatibility. However, the term duck-typing seems to me at least to intuitively subsume structural sub-typing systems. In fact Wikipedia says: The name of the concept [duck-typing] refers to the duck test , attributed to James Whitcomb Riley which may be phrased as follows: "when I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck." So my question is: why can't I call structural subtyping duck-typing? Do there even exist dynamically typed languages which can't also be classified as being duck-typed? Postscript: As someone named
Tags (comma-separated)
Save Edits
Cancel