reflect on this function

Vlad Levenfeld via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 20 14:32:53 PST 2015


I'd like to do something like this:

   @reflexive @transitive bool relation (T)(T a, T b)
   out (result) {
     mixin(property_verification!result);
   }
   body {
     ...
   }

which becomes

   out (result) {
      // generated from @reflexive
     assert (result == skip_contract!relation (b,a));

     // generated from @transitive
     static typeof(result) c;
     if (result)
       assert (skip_contract!relation (b,c) == 
skip_contract!relation (a,c));
     c = b;
   }

or something like that. I don't see a way to get exactly this, 
but does anyone have any thoughts on something similar?


More information about the Digitalmars-d-learn mailing list