On 7/23/15 5:07 AM, Walter Bright wrote:
On 7/22/2015 11:47 PM, Jacob Carlborg wrote:
On 2015-07-22 20:47, simendsjo wrote:

Traits
------
I think the ability to express an interface without buying into
inheritance is the right move. The alternative in D is specifying the
behavior as a template

I completely agree and don't really like the approach D has
implemented template
constraints. Yeah I know, Andrei will destroy this :)

Consider that template constraints can be arbitrarily complex, and can
even check behavior, not just a list of function signatures ANDed
together. Turns out many constraints in Phobos are of the form (A || B),
not just (A && B).

Agreed. And that's just scratching the surface.

Serious question: how do you express in Rust that a type implements one trait or another, then figure out statically which?

 >> and verifying the contract in a unittest for the type.

I am a bit puzzled by the notion of shipping template code that has
never been instantiated as being a positive thing. This has also turned
up in the C++ static_if discussions.

This is easy to understand. Weeding out uncovered code during compilation is a central feature of C++ concepts. Admitting you actually never want to do that would be a major blow.


Andrei

Reply via email to