I came across two different definitions of "Duck Typing." Sure, there are people who will tell you that one of them is “right” and the other is “wrong.” I'm just trying to write that they are both used, and not telling you that they are both “correct”, but personally I don’t see anything bad in a broader sense.
1) input only at run time. A type is a property of objects, not variables, and therefore, it is mandatory that when you come to a method call on an object or otherwise use properties that it has due to its type, the presence or absence of this method is detected at runtime [*] . So, if it “looks like a duck and quacks, like a duck” (that is, if it has the quack() function), then it “is” a duck (in any case, you can consider it as one). By this definition, of course, C ++ templates fall from the first hurdle, they use static typing.
2) The name used in a more general sense for the principle that if it looks like a duck and a quack, like a duck, then it is a duck, meaning any installation in which interfaces are implicitly determined by the operations performed by the consumer interface, rather than interfaces that are explicitly advertised by the manufacturer (regardless of what the interface implements). By this definition, C ++ templates use some kind of duck print, but is there something defined “like a duck” at compile time, and not at run time, based on its static type and not its dynamic type. "Check compile time, can this variable be of static type quack?", And not "check at runtime, can this object quack?".
The argument, in my opinion, in my opinion, is that Python "owns" the term, so that only systems like Python can be called duck typing, or others can use this term to refer to a similar concept in a different context. No matter what you think it should mean, it seems irresponsible to use the term "jokey" and demand that everyone understand the same formal definition. SO is not a suitable forum to tell you what the term "should" means if there is no authoritative source that you are asking for, for example, a dictionary or any scientific documents that formally define it. I think he can tell you what he really meant.
General programming can use duck printing or not, depending on the exact details. C ++ generic containers use duck printing of type 2 because for a generic type in C ++ it does not guarantee that you can copy it, compare it, get a hash value, etc. No Java containers, Object has enough methods to make it hashable, etc.
Conversely, I suspect that everything you do that uses duck printing can reasonably be called "universal programming." Therefore, I assume that in the terms you requested, GP> DT is that duck typing (or definition) is a strict subset of a wide range of things that can be called "general."
[*] Well, in some cases, your dynamic language may have some static analysis, which proves the case one way or another, but the language requires the ability to postpone this check until execution time for cases where the static analysis cannot finally say.