concepts v0.0.6: use a run-time interface to specify a compile-time one

Juanjo Alvarez via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu May 11 01:22:49 PDT 2017


On Wednesday, 10 May 2017 at 10:53:59 UTC, Atila Neves wrote:
> http://code.dlang.org/packages/concepts
>
> concepts is a dub package and library that allows one to 
> declare that a struct conforms to a "compile-time interface" 
> such as `isInputRange`. The difference between this and a 
> simple `static assert(isInputRange!MyType)` is that when the 
> static assert fails you have no idea why not and half of the 
> time it's because of a typo (e.g. `popFrnt`). With concepts you 
> get an error message from the compiler, and you can still use 
> your concepts in template constraints.

Niiiiice, I love constraints but there error messages aren't the 
best.




More information about the Digitalmars-d-announce mailing list