Compile-Time Interfaces (Concepts)

Justin Whear via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 17 16:19:19 PDT 2014


On Thu, 17 Jul 2014 23:06:30 +0000, bearophile wrote:

> Justin Whear:
> 
>> What benefits would accrue from adding this?  Static verification that
>> a structure implements the specified concepts?
> 
> Not just that, but also the other way around: static verification that a
> "Concept" is strictly sufficient for any instantiation of a specific
> template. This is what Haskell/Rust do.
> 
> Bye,
> bearophile

By this do mean replacing the template constraint `if (isInputRange!R)` 
syntax?  If so, we need concept definition syntax, but we do not 
necessarily need a "struct realizes concept" syntax.  And, in fact, I 
would argue against it as a static assert would continue to be sufficient.


More information about the Digitalmars-d-learn mailing list