Boost logo

Boost :

From: Marc Jacobs (marcja_at_[hidden])
Date: 2002-10-30 18:01:59


"Martin" <m_at_[hidden]> wrote in message
news:appits$jq3$1_at_main.gmane.org...
> ~myContract()
> {
> // If this is a function in a class, we would imlement
> // testing of invariant conditions here. This would require
> // a reference to the object however.
> // Invariants are implemented here because this gets
> // executed even when exceptions are thrown
> }

[snip]

> The biggest problem i see is the access to the input parameters from
withing
> the class. This complicates the code and it means that with larger number
of
> parameters you have to write too much extra code.

The biggest problem I see is that you have no safe way to test invariants
from a destructor. There can be no return value from a destructor and
destructors should never throw if exception-safety is any kind of goal
(because if you arrived at that destructor because run() threw, for example,
and then the destructor threw, you'd end up with a terminated thread pretty
quickly...)

As for the rest, well, I'm having difficulty envisioning how you mean to
make this generic. Where will the author provide implementations for
preconditions, body, postconditions, etc. if not explicitly in the class
body as you have now?
Marc


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk