On Friday, 24 July 2015 at 06:42:47 UTC, Walter Bright wrote:
On 7/23/2015 10:39 PM, Tobias Müller wrote:
You may aus well ask "How do interfaces in OO programming deal
with this?".
It's a good question. And the answer is, the top level function
does not list every interface used by the call tree. Nested
function calls test at runtime if a particular interface is
supported by an object, using dynamic casting or
QueryInterface() calls. It's fundamentally different from
traits and concepts.
It is not required and probably shouldn't, or at least shouldn't
in many cases.
This problem is the exact same one as strongly typed vs
dynamically typed languages, except at compile time. And solution
are the same: interface (concepts) or duck typing and hope for
the best.
The end goal is pretty much the same: writing reusable code. The
implementation differs, performances as well, but that is pretty
much it.