Lutger wrote:
Yigal Chripun wrote:
...
IMHO, duck-typing in D is a tragic mistake...  This should have been
implemented with compile time interfaces.

Care to provide arguments?



duck typing makes more sense in dynamic languages like Ruby which is famous for it.

in static languages I as a user prefer to trade flexibility due to duck-typing for compile time checks.

yes, at compile time, duck typing and (compile-time) interfaces are basically the same thing, but since the rest of the language uses formal interfaces, it is more consistent (and easier to understand) to use the same approach at compile-time as well. point in case, look how much unnecessary confusion Ranges cause which would be eliminated had D allowed for compile-time interfaces.
i.e.
Interface I { .. }
struct S : I { ... }
this is basically the same as C++ concepts only without redundant and confusing syntax.

templates are hard for users to understand and one of the main reasons for this is that templates are essentially a completely different language with different syntax and semantics which to me looks like mis-design.

Reply via email to