On Fri, 20 Feb 2015 22:32:53 +0000, Vlad Levenfeld wrote: > 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?
can you go with `relationImpl` and mixin/template that generates `relation` with contract then? something like: @reflexive @transitive bool relationImpl (T)(T a, T b) { ... } alias relation = buildWithContracts!relationImpl; then you can simply call `relationImpl` in your out section. sorry if i didn't understand what you want and just throws in some noise.
signature.asc
Description: PGP signature