Re: reflect on this function

2015-02-20 Thread ketmar via Digitalmars-d-learn
On Fri, 20 Feb 2015 22:51:21 +, Vlad Levenfeld wrote: > On Friday, 20 February 2015 at 22:44:35 UTC, ketmar wrote: >> 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

Re: reflect on this function

2015-02-20 Thread Ali Çehreli via Digitalmars-d-learn
On 02/20/2015 02:32 PM, 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

Re: reflect on this function

2015-02-20 Thread Vlad Levenfeld via Digitalmars-d-learn
On Friday, 20 February 2015 at 22:44:35 UTC, ketmar wrote: 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 yo

Re: reflect on this function

2015-02-20 Thread ketmar via Digitalmars-d-learn
On Fri, 20 Feb 2015 22:32:53 +, 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) {

reflect on this function

2015-02-20 Thread Vlad Levenfeld via Digitalmars-d-learn
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));