Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Contract Review Period Extended
From: ecyrbe (ecyrbe_at_[hidden])
Date: 2012-09-06 12:57:18

2012/9/6 Lorenzo Caminiti <lorcaminiti_at_[hidden]>

> On Thu, Sep 6, 2012 at 7:05 AM, ecyrbe <ecyrbe_at_[hidden]> wrote:
> > I vote NO for the inclusion of the contract library in Boost.
> Thanks a lot for submitting a review!

I think my tone could seem a litle rude. I forgot to congratulate you for
the long a hard work you have done on this library.

> > I do agree that the work done is really interresting, but i don't think
> > that using MACROS are the way to add this functionnality.
> Sure this'd be ideal but... do you have any suggestion on how to
> implement Contract Programming within C++ without using macro? I
> thought about this problem a lot (that of "not using macros" was even
> an original goal when I started creating the library 4+ years ago) but
> I had to conclude it's impossible... For example (and there are more
> examples like this) how would you implement the following CP
> requirements without macros?
> 1. If a function is not public, don't check class invariants.
> 2. Subcontracting.
I would like to comment on this. I know that making a Eiffel like
integrated contract programming in c++ in not feasible.
But i think that an original one, maybe based on functors could be possible
(may be i'm totally wrong).

something declared like a boost::function<Signature>, but using something
like :

   boost::contract<Signature> push_back;

and has to be initialized like this :


and if any invariant is declared :

real_push_back_method,postcondition_functor, invariant_functor);

I know that it's not easy to implement functors in c++03 , but in c++11
with lambdas, you could initialize this really easily, and still have a
nice library.
For c++03, you still could provide a macro frontend to allow users to
implement this easily, but having a more native way to do it in c++11 would
be awesome.

What i want to say, is that, i would have said YES to this macro frontend
if a nice c++11 compliant backend was exposed to those that don't want to
use macros.

These are only thoughts.

Thanks for reading.

Boost list run by bdawes at, gregod at, cpdaniel at, john at