I just watched this talk from the goto conference by Walter Bright (https://www.youtube.com/watch?v=cQkBOCo8UrE) and he makes reference to "concepts." However, they look almost identical to Protocols in Smalltalk -- something which I would very much like to see in D.

It basically works much like an interface, but instead of declaring it, you check the type to see if it defines the appropriate methods.

In fact -- I believe this could be implemented today with __traits and static foreach to simply check to see if a type conforms to a protocol at compile time.

implementsProtocol!( R, InputRange!(int) );

where InputRange!() could just be a templated interface.

Having this in phobos would be really helpful! If there is interest in this, I'll write a template up and submit it to phobos.

-Shammah


Reply via email to