concepts v0.0.1

Atila Neves via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Dec 16 12:51:19 PST 2016


Since my phobos PR for better static assertions was clearly never 
getting merged (https://github.com/dlang/phobos/pull/3677), I 
moved the code to dub instead:

http://code.dlang.org/packages/concepts

Basically, as long as you pair up your template constraints (e.g. 
isFoo) with a suitably named function that should compile (e.g. 
checkFoo, not a lambda), then you can write this:

@models!(Foo, isFoo)
struct Foo {
     //...
}

And in the case that isFoo is false, you'll get to know _why_ it 
didn't compile instead of an AssertError that leaves you confused.

At least it used to and the unit tests pass so I'm assuming it 
still does :P

Atila


More information about the Digitalmars-d-announce mailing list